Say I have a sorted list of values in column A. They serve as a 'key' to each numerical row. Something like this:
___A_(key)_______B______ ______G_____
1 |____2.58___|____________| ... |____________| ...
2 |____2.69___|____________| ... |____________| ...
... ... ...
________________________ ____________
x |____5.69___|____________| ... |____________| ...
Columns B through G have some values for each of the keys, so it's basically a 2D spreadsheet of numerical data.
I need to be able to quickly access a certain row by the approximate value.
Right now I have set a Filter on the column, and can search for the rows, but for that I need to enter the key value exactly, i.e. 2.58
, or 2.69
, but not something like 2.64
.
I want to be able to enter something like 2.64
, and have the row with nearest key value be shown to me, preferably in a separate location, such as on the side of the table, like starting in column I where exactly can be defined, but basically any method where I type in a value and get conveniently shown the row values will do. How can I do this?
My experience level is: I did some simple stuff in VBA/excel ~10 years ago... and basically looking for a good starting direction and approach.
Assuming your Data is in
A1:A20
and your look up value is inB1
this formula will return the closest:When entering make sure to press Ctrl + Shift + Enter and NOT just Enter.
It is getting the smallest difference then returning its row into the index, index then returns the value.
This is what I'm thinking, You loop through all the rows and get the difference between your target and the value in that cell. You find the row that gives the least difference and that will be your target row.