Help with IF statement

S

Sean.rogers

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

Max

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")
 
M

MartinW

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
 
P

Pete_UK

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
 
M

MartinW

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
 
M

Max

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top