Help with IF statement

  • Thread starter Thread starter Sean.rogers
  • Start date Start date
S

Sean.rogers

Can you have multiple tests, in the test section of the if statement? For
example.
If (A2=1or2or5or25,True,False)
 
Sean.rogers said:
Can you have multiple tests, in the test section of the if statement? For
example.
If (A2=1or2or5or25,True,False)

Try it like this: =IF(OR(A1={1,2,5,25}),"Y","N")

---
 
Hi Sean,

You can do it like this,
=IF(OR(A2=1,A2=2,A2=5,A2=25),TRUE,FALSE)

or you can be simplify it like this,
=IF(OR(A2={1,2,5,25}),TRUE,FALSE)

HTH
Martin
 
You could simplify that further:

=OR(A2=1,A2=2,A2=5,A2=25)

or just:

=OR(A2={1,2,5,25})

Hope this helps.

Pete
 
Yep, I always think in terms of IF and forget the fact
that sometimes it is irrelevant.

I don't think I'll ever manage to expel that habit. <bg>

Regards
Martin


You could simplify that further:

=OR(A2=1,A2=2,A2=5,A2=25)

or just:

=OR(A2={1,2,5,25})

Hope this helps.

Pete
 
Can I include an arrey that referances another sheet?

Do you mean something like this, which needs to be array-entered
ie press CTRL+SHIFT+ENTER to confirm the formula:
=IF(OR(A1=MyR),"Y","N")
where MyR refers to a col range on another sheet containing the values:
1,2,5,25

---
 
Back
Top