Using OR AND IF to solve equation

richardthelionheart

Board Regular
Joined
Mar 25, 2016
Messages
95
Office Version
  1. 2016
Platform
  1. Windows
'=IF(AH1=AL1,OR,AH1=AM1,OR,AH1=AN1,"YES", " ")

So I'm trying to find a YES if any nunbers in AL1 or AM1 or AN1 match the number in cell AH1. The numbers found in AL1,AM1 and AN1 will always be different. I've researched "OR" but have found only examples that do not include "find any that match". Would really appreciate some help here. I'm happy to get a "TRUE" result instead of "YES" - that's of no consequence.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Here's two ways (I'm sure there's more :)):

=IF(OR(AH1=AL1,AH1=AM1,AH1=AN1),"YES","")
=IF(COUNTIF(AL1:AN1,AH1)>=1,"YES","")

Regards,

Robert
 
Last edited:
Upvote 0
Just one more:

=IF(ISERROR(LOOKUP(AH1,AL1:AN1)),"","YES")

This and my COUNTIF suggestion are better for large ranges as you are limited to the number of OR arguments (30 I think) and as they get larger they are more cumbersome to maintain (in my humble opinion).

;)
 
Last edited:
Upvote 0

Excel 2010
CD
1TRUE
2Yes
3
2b
Cell Formulas
RangeFormula
C1=OR(AH1=AL1,AH1=AM1,AH1=AN1)
C2=IF(OR(AH1=AL1,AH1=AM1,AH1=AN1),"Yes","No")
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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