简体   繁体   中英

Find corresponding column title for a specific value (based on 2 criteria)

Sheet 1 contains some IDs and unique activity codes (CE, CI, EE, etc.) belong to that ID.

在此处输入图片说明

On sheet 2, I need to find the corresponding activity number (Activity 1, 2, or 3) for each activity code (CE, CI, EE, etc.) under that specific ID.

在此处输入图片说明

For example, sheet 2 row 2, Activity EE of ID 20001 is the 3rd Activity (Activity 3) based on the Sheet 1.

Ideally, the result should look like this:

在此处输入图片说明

Does anyone know what functions can I use to achieve this result? I need to avoid using VBA for this, and I don't want to create any extra concatenated "reference" column. Any hints would be appreciated!

使用一个 INDEX/MATCH 返回正确的行,使用另一个从该行获取正确的列。

=INDEX(Sheet1!$B$1:$F$1,MATCH(B2,INDEX(Sheet1!$B:$F,MATCH(A2&"",Sheet1!$A:$A,0),0),0))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM