Checking a range for specific criteria

Reboshua

Board Regular
Joined
Jan 23, 2015
Messages
88
I'd like to put a formula in I2 that checks a2:h2 to see if this range of colors conforms to what I need.

The range A2:H2 must contain at least:

1 Red
1 Orange
1 Yellow
3 Blue
1 Violet
1 [Any of the above colors]

If the range conforms to the restrictions, I'd like it to leave a blank cell. If it does NOT conform, I'd like it to print "NO!"

I am hoping there is a better way to do this than a big nested IF statement.

Thanks!

Excel 2016 (Windows) 64 bit
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]A[/COLOR]​
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]B[/COLOR]​
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]C[/COLOR]​
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]D[/COLOR]​
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]E[/COLOR]​
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]F[/COLOR]​
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]G[/COLOR]​
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]H[/COLOR]​
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]I[/COLOR]​
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]1[/COLOR]​
Color1Color2Color3Color4Color5Color6Color7Color8Good?
[COLOR=[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFFFFF]#FFFFFF[/URL] ]2[/COLOR]​
RedOrangeYellowBlueBlueBlueVioletBlack

<tbody>
</tbody>
Sheet: Sheet1

<tbody>
</tbody>
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
There is nesting, but it's not nested IFs. I think this works okay for the formula in I1:

Code:
=IF(AND(OR(COUNTIF(A1:H1,"=Red")=2,COUNTIF(A1:H1,"=Red")=1),OR(COUNTIF(A1:H1,"=Orange")=2,COUNTIF(A1:H1,"=Orange")=1),OR(COUNTIF(A1:H1,"=Yellow")=2,COUNTIF(A1:H1,"=Yellow")=1),OR(COUNTIF(A1:H1,"=Blue")=4,COUNTIF(A1:H1,"=Blue")=3),OR(COUNTIF(A1:H1,"=Violet")=2,COUNTIF(A1:H1,"=Violet")=1),SUM(COUNTIF(A1:H1,"=Red"),COUNTIF(A1:H1,"=Orange"),COUNTIF(A1:H1,"=Yellow"),COUNTIF(A1:H1,"=Blue"),COUNTIF(A1:H1,"=Violet"))=8),"","NO!")
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,755
Members
449,094
Latest member
dsharae57

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