ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Help with IF statement (https://www.excelbanter.com/excel-worksheet-functions/184842-help-if-statement.html)

Sean.rogers[_2_]

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

Max

Help with IF statement
 
"Sean.rogers" wrote:
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")
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---

MartinW

Help with IF statement
 
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


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




Sean.rogers[_2_]

Help with IF statement
 
Thank you worked like a charm.

"Max" wrote:

"Sean.rogers" wrote:
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")
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


Pete_UK

Help with IF statement
 
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

On Apr 23, 1:24*pm, "MartinW" wrote:
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

"Sean.rogers" wrote in message

...



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


- Show quoted text -



Sean.rogers[_2_]

Help with IF statement
 
Can I include an arrey that referances another sheet?

"Max" wrote:

"Sean.rogers" wrote:
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")
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


MartinW

Help with IF statement
 
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


"Pete_UK" wrote in message
...
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

On Apr 23, 1:24 pm, "MartinW" wrote:
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

"Sean.rogers" wrote in message

...



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


- Show quoted text -




Max

Help with IF statement
 
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
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---




All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com