Home » excel » excel – Lookup in top row with selector from column

excel – Lookup in top row with selector from column

Posted by: admin May 14, 2020 Leave a comment


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
B           T               
C               K           
E                       T   

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

How to&Answers:

Assuming a datasetup like this:

enter image description here

In cell J2 and copied down is this formula:



Assuming your table is in A1:G7 you could set your formula up as follows:


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")