简体   繁体   中英

Excel lookup value in all rows, not just 1st match

I have the following table with columns ID and X1, and I want to obtain X2. 图片

If one row is YES in the X1 column, then in X2 column all rows with that same ID should be YES. Otherwise it should be NO. For example, ID=106629-1 (yellow) has 2 rows with NO but 1 with YES, then all three should be YES in X2 column. The other 2 IDs (orange and blue) have all rows with NO, then X2 should be NO as well.

I've tried VLOOKUP , but it only considers the 1st match.

Use COUNTIFS to see if any are marked YES

=IF(COUNTIFS(A:A,A2,B:B,"YES"),"YES","NO")

在此处输入图像描述

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