Excel/Index and Match Error, is this possible?
I have a spreadsheet which has a table with multiple values in it. i.e. columns 1 to 3 have different numbers in them depending on user input and choice (eg. col1 m3/hr, col2, kWGross, col3 kWNet)
the other 7 columns have the reference data with a header row, this contains numbers.
what I want to do is be able to index and match a column and row within the table dependant on the 2 values the user inputs. e.g. gas rate and pipe diameter.
I have tried to use the following formula (note this is a non working formula coming up with n/a error all the way through:=)
All data is on one sheet at the moment until I can get the formula working.
User entered data is in cells n5 and n6
=index($A4:$j50, match($n5,$c4:j50,-1), match($n6,$d4:j4,0))
The problem I think is that the first match criteria has multiple possibilities as the data is never likely to be an exact match, also there are multiple numbers that are greater (hence why I used the -1 suffix in the match). Is excel getting confused because there are lots of numbers larger than what the user enters or am I missing something?
Is there any way to get the match statement to take the first number that is higher than the entered value? Is this even possible?
All help very gratefully received.
>Is there any way to get the match statement to take the first number that is higher than the entered value?
from a general perspective, if the data is sorted descending for this column and you use the -1 as the third argument to match, then it will give you the next higher number
For the formula You show have a couple of problems.
Match works against a single column or single row. You first match is against multiple columns and multiple rows.
If we assume you want to find the row with the first Match and the column with the second, then you would need to sort your table on descending on the column you want to use to find the row. Assume that is column C.
=index($A4:$j50, match($n5,$c$4:$C$50,-1), match($n6,$A$4:$J$4,0))
Note that for the second match, I start in column A instead of column D. since you are looking for an exact match, I would guess that would not be a problem. If it is you could do
hopefully this answers the question. If not, you can email me the worksheet and I can take a look. email@example.com