Multiple OR Statements

jlkirk

Active Member
Joined
May 6, 2002
Messages
307
I know I have seen this somewhere, but can't seem to find it. I have a column of names (B1:B10). What I would like to do is put a formula in C1 that inserts "YES" if three (3) specific names (for example, "John", "Mary", or "Frank") are present in B1:B10, and "NO" if they aren't .
Taks in advance.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

jlkirk

Active Member
Joined
May 6, 2002
Messages
307
Sorry,
If ANY of the three names are present, insert "YES", and if none of the three are present, insert "NO".
Thanks.
 
Upvote 0

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,892
Try:

=IF(SUMPRODUCT(--ISNUMBER(MATCH({"John","Mary","Frank"},B1:B10,0))),"Yes","No")
 
Upvote 0

Colin Legg

MrExcel MVP
Joined
Feb 28, 2008
Messages
3,497
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi,

To check that all 3 names are present you could use this:
Code:
=IF(SUM(--ISNUMBER(MATCH({"John","Mary","Frank"},B1:B10,0)))=3,"Yes","No")

To check that at least one of the names is present you could use this:
Code:
=IF(SUM(COUNTIF(B1:B10,{"John","Mary","Frank"})),"Yes","No")
 
Upvote 0

Forum statistics

Threads
1,191,691
Messages
5,988,118
Members
440,126
Latest member
duque00

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
Top