I’m trying to do a “backwards” lookup.
Please see JsFiddle here for show and where I have created a little table.
TopRow 1 2 3 4 5 6
A
B T
C K
D
E T
F
With Vlookup-function I can easily look up what is on the table. But I need to get returned what is in TopRow
. E.g. If I select C
I will have 3
returned.
How do I do that?
Thanks in advance.
I am aware of this earlier question but it is numbers only:
Lookup Return Top Row
Assuming a datasetup like this:
In cell J2 and copied down is this formula:
=IFERROR(INDEX($B$1:$G$1,MATCH(TRUE,INDEX(INDEX($B$2:$G$7,MATCH(I2,$A$2:$A$7,0),0)<>"",),0)),"")
Answer:
Assuming your table is in A1:G7 you could set your formula up as follows:
=INDEX(A1:G1,AGGREGATE(15,6,COLUMN(B1:G1)/(INDEX(B2:G7,MATCH($I$2,$A$2:$A$7,0),0)<>""),1))
I placed the row name that was being looked up in I2
Now you did not say what you wanted to happen if nothing was found, but you can wrap the whole thing in an IFERROR statement that will say “Not Found” or “All Blank”
=IFERROR(INDEX(A1:G1,AGGREGATE(15,6,COLUMN(B1:G1)/(INDEX(B2:G7,MATCH($I$2,$A$2:$A$7,0),0)<>""),1)),"All Blank")
Tags: excelexcel, select