In Excel for Mac 2011, I am trying to create a table (in columns D-G
) that references the data in A1:B5
. I want E1
to search column A
and report the data in column B
corresponding to the first match; F1
to search column A
and report the second match; G1
the third match, etc. VLOOKUP
would solve the problem for E1
, but to my knowledge can't handle anything past the first match.
Here is the formula I have found in other help sites:
=INDEX($B$1:$B$5,SMALL(IF($A$1:$A$5=$D$1,ROW($A$1:$A$5)-MIN(ROW($A$1:$A$5))+1,""),COLUMN(A1)))
This works perfectly for E1
, but results in a #NUM!
error in cell F1
. I entered the following formula into another cell and got a value of 1
, which led me to believe that my formula is only finding one match:
=MAX((IF($A$1:$A$5=$D$1,ROW($A$1:$A$5)-MIN(ROW($A$1:$A$5))+1,"")))
I can't figure out where the first formula is going wrong. If anyone has any ideas, or other ways to do this, that would be greatly appreciated!