lookup values in range and return yes if all values are found.

droot

New Member
Joined
Oct 18, 2018
Messages
36
Office Version
  1. 365
Platform
  1. Windows
Hi, I'm stuck with a problem and can't work out the solution.

I'm trying to lookup IDs and return Yes or No depending on if all of the values correspond with the ID.

This is an example of my table -

ID​
Product​
1​
Red​
1​
Blue​
1​
Green​
1​
Yellow​
2​
Red​
2​
Blue​
3​
Red​
3​
Blue​
3​
Green​
3​
Yellow​

These are the values -

Values​
Red​
Blue​
Green​
Yellow​

So ID "1" will return Yes, ID "2" will return No and ID "3" will return Yes.

Hope this makes sense.
Thanks in advance.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

If you have Microsoft 365, you could try this. I have assumed that the only possible colours are the four that you have mentioned.

21 08 02.xlsm
ABCDE
1IDProduct
21Red1Yes
31Blue2No
41Green3Yes
51Yellow 
62Red 
72Blue
83Red
93Blue
103Green
113Yellow
Check All
Cell Formulas
RangeFormula
D2:D4D2=UNIQUE(A2:A11)
E2:E6E2=IF(D2="","",IF(ROWS(UNIQUE(FILTER(B$2:B$11,A$2:A$11=D2)))=4,"Yes","No"))
Dynamic array formulas.
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

If you have Microsoft 365, you could try this. I have assumed that the only possible colours are the four that you have mentioned.

21 08 02.xlsm
ABCDE
1IDProduct
21Red1Yes
31Blue2No
41Green3Yes
51Yellow 
62Red 
72Blue
83Red
93Blue
103Green
113Yellow
Check All
Cell Formulas
RangeFormula
D2:D4D2=UNIQUE(A2:A11)
E2:E6E2=IF(D2="","",IF(ROWS(UNIQUE(FILTER(B$2:B$11,A$2:A$11=D2)))=4,"Yes","No"))
Dynamic array formulas.
Thanks for your reply.

I haven't explained this very well, let me try again.

I have two sheets. Sheet1 contains the raw data and Sheet2 contains just the unique IDs. In Sheet2 I'm trying to use a lookup formula to check the data in Sheet 1 and trying to return Yes if all of the key values are present.

This is what I've tried but doesn't work -
=IF(VLOOKUP(A2,Sheet1!$A$2:$B$10,2,FALSE)={"Red","Blue","Green","Yellow"},"Yes","No")

I think the vlookup is only checking the first instance and looking for any of the strings in the curly brackets instead of all.
 
Upvote 0
Thanks for updating your profile. (y)

In what way does the FILTER formula I suggested, adapted for two sheets, fail?

droot.xlsm
AB
1IDProduct
21Red
31Blue
41Green
51Yellow
62Red
72Blue
83Red
93Blue
103Green
113Yellow
12
Sheet1


droot.xlsm
AB
1Unique IDsCheck
21Yes
32No
43Yes
5 
6 
Sheet2
Cell Formulas
RangeFormula
B2:B6B2=IF(A2="","",IF(ROWS(UNIQUE(FILTER(Sheet1!B$2:B$11,Sheet1!A$2:A$11=A2)))=4,"Yes","No"))
 
Upvote 0
Thanks for updating your profile. (y)

In what way does the FILTER formula I suggested, adapted for two sheets, fail?

droot.xlsm
AB
1IDProduct
21Red
31Blue
41Green
51Yellow
62Red
72Blue
83Red
93Blue
103Green
113Yellow
12
Sheet1


droot.xlsm
AB
1Unique IDsCheck
21Yes
32No
43Yes
5 
6 
Sheet2
Cell Formulas
RangeFormula
B2:B6B2=IF(A2="","",IF(ROWS(UNIQUE(FILTER(Sheet1!B$2:B$11,Sheet1!A$2:A$11=A2)))=4,"Yes","No"))
I can have an unlimited number of IDs with various different values but I'm only interested in a particular set. That formula seems to be looking for 4 uniques before returning a Yes (if I'm interpreting it correctly).
 
Upvote 0
Maybe
+Fluff 1.xlsm
ABCDEFG
1IDProduct
21Red1YesRed
31Blue2NoBlue
41Green3YesGreen
51YellowYellow
62Red
72Blue
83Red
93Blue
103Green
113Yellow
12
List
Cell Formulas
RangeFormula
E2:E4E2=IF(SUM(--IFERROR($G$2:$G$5=FILTER($B$2:$B$11,$A$2:$A$11=D2),0))=4,"Yes","No")
 
Upvote 0
I can have an unlimited number of IDs with various different values but I'm only interested in a particular set.
OK, see if this is better. I have introduced some more colours.

droot.xlsm
AB
1IDProduct
21Red
31Blue
41Green
51Yellow
62Red
72Blue
83Red
93Blue
103Green
113Pink
124Red
134Yellow
144Orange
154Green
164Blue
174Green
18
19
20
Sheet1


Check 1 uses the list in column F
If you don't want to use a list in the worksheet but have the LET function then try Check 2
If you also do not have the LET function then try Check 3

droot.xlsm
ABCDEF
1Unique IDsCheck 1Check 2Check 3
21YesYesYesRed
32NoNoNoBlue
43NoNoNoGreen
54YesYesYesYellow
Sheet2
Cell Formulas
RangeFormula
B2:B5B2=IF(COUNT(MATCH(F$2:F$5,FILTER(Sheet1!B$2:B$20,Sheet1!A$2:A$20=A2),0))=ROWS(F$2:F$5),"Yes","No")
C2:C5C2=LET(clrs,{"Red","Blue","Green","Yellow"},IF(COUNT(MATCH(clrs,FILTER(Sheet1!B$2:B$20,Sheet1!A$2:A$20=A2),0))=COUNTA(clrs),"Yes","No"))
D2:D5D2=IF(COUNT(MATCH({"Red","Blue","Green","Yellow"},FILTER(Sheet1!B$2:B$20,Sheet1!A$2:A$20=A2),0))=COUNTA({"Red","Blue","Green","Yellow"}),"Yes","No")
 
Upvote 0

Forum statistics

Threads
1,215,875
Messages
6,127,477
Members
449,385
Latest member
KMGLarson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top