ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   If Function with multiple variables (https://www.excelbanter.com/excel-discussion-misc-queries/174740-if-function-multiple-variables.html)

Fritz

If Function with multiple variables
 
On a worksheet, I am using an If function, but now I need to add a second set
of variables to that If function, how can I accomplish that?

Nick Hodge[_2_]

If Function with multiple variables
 
Fritz

Just nest them. You can go up to 7 levels deep in versions before 2007 (Some
more using range names) but if you need more that that you should really
consider a table and VLOOKUP or similar. the syntax for IF are

=IF(test,
this_value_if_true,IF(test2,this_value_if_true2,th is_value_if_false2))

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.excelusergroup.org
web: www.nickhodge.co.uk





"Fritz" wrote in message
...
On a worksheet, I am using an If function, but now I need to add a second
set
of variables to that If function, how can I accomplish that?



Fred Smith[_4_]

If Function with multiple variables
 
If both variables need to be true, you can use the And function, as in:

=if(and(a1=1,b1=2),true,false)

If either variable need to be true, you can use the Or function, as in:

=if(or(and=1,b1=2),true,false)

Regards,
Fred

"Fritz" wrote in message
...
On a worksheet, I am using an If function, but now I need to add a second
set
of variables to that If function, how can I accomplish that?




All times are GMT +1. The time now is 06:44 PM.

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