Michi
Michi

Reputation: 5471

Find column name based on search criteria

I have the following Excel spreadsheet:

        A        B         C              D              E          F       
1     MFC2      MFC1      QFC      Search Criteria:     CW14
2     CW11                         Column Name:         MFC1
3               CW13   
4               CW14 
5                        CW17
6                        CW18
7                        CW19
8
9

In Cells A1:C8 I have different calender weeks. All of them are unique!
In Cell E2 I want that the column name is displayed based on the value that is put in Cell E1.
In this case the search criteria is CW14 so the result should be column name MFC1.


I tried to modify the formula from this question but could not make it work:

E1 = INDEX($A$1:$C$1,MATCH(E$1,$A$2:$C$30,0))

This formula gives me #NV as result.
What do I need to change to get the desried result?

Upvotes: 2

Views: 125

Answers (2)

Ron Rosenfeld
Ron Rosenfeld

Reputation: 60174

=INDEX($A$1:$C$1,MAX(ISNUMBER(FIND(E1,$A$2:$C$7))*COLUMN($A$2:$C$7)))

enter image description here

Upvotes: 1

Scott Craner
Scott Craner

Reputation: 152450

Use AGGREGATE instead of MATCH:

=INDEX(1:1,AGGREGATE(15,7,COLUMN($A$2:$C$30)/($A$2:$C$30=$E$1),1))

enter image description here

Upvotes: 1

Related Questions