ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   testing more than one variable in an if statement (https://www.excelbanter.com/excel-discussion-misc-queries/14418-testing-more-than-one-variable-if-statement.html)

Charles

testing more than one variable in an if statement
 
I would like to be able to test more than one variable in an if statement.
Such as the contents of a1 and the contents of a2. Is this possible?

Peo Sjoblom

=IF(OR(A1="x",A2="x"),"yes","no")

or

=IF(AND(A1="x",A2="x"),"yes","no")

depending on what you want

--

Regards,

Peo Sjoblom

"Charles" wrote in message
...
I would like to be able to test more than one variable in an if statement.
Such as the contents of a1 and the contents of a2. Is this possible?




Biff

Hi!

Yes, this is possible but you need to provide more
specific info.

Here are a few things you can do:

=IF(OR(A1="",B2="")......
=IF(AND(A1="",B2="").....
=IF(A1="",IF(B2<100.....

Biff

-----Original Message-----
I would like to be able to test more than one variable in

an if statement.
Such as the contents of a1 and the contents of a2. Is

this possible?
.


Jay


I would like to be able to test more than one variable in an if
statement. Such as the contents of a1 and the contents of a2. ...


Check out "logical" functions like AND and OR. Example:
=IF(AND(A13,A2<0),"good","bad")



All times are GMT +1. The time now is 10:22 PM.

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