Find column name based on search criteria

淺唱寂寞╮ 提交于 2020-08-17 05:51:09

问题


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?


回答1:


Use AGGREGATE instead of MATCH:

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




回答2:


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



来源:https://stackoverflow.com/questions/60283639/find-column-name-based-on-search-criteria

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!