ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to combine "IF" functions (https://www.excelbanter.com/excel-worksheet-functions/160021-how-combine-if-functions.html)

BeeCee

How to combine "IF" functions
 
I have this function =IF(L9="w1",5,0) to test a cell for the text "w1" and
return value 10 if true, value 0 if false. This works as I want it to.

Now I want to test the same cell for text "w2" and return 10 if true. As a
stand-alone operation this would be =IF(L9="w2",10,0).

How can I combine these two functions in a single statement to test the cell
for either "w1" or "w2" returning either 5 or 10, and 0 if false?

Brian



Mike

How to combine "IF" functions
 
=IF(L9="w1",5,IF(L9="w2",10,0))

"BeeCee" wrote:

I have this function =IF(L9="w1",5,0) to test a cell for the text "w1" and
return value 10 if true, value 0 if false. This works as I want it to.

Now I want to test the same cell for text "w2" and return 10 if true. As a
stand-alone operation this would be =IF(L9="w2",10,0).

How can I combine these two functions in a single statement to test the cell
for either "w1" or "w2" returning either 5 or 10, and 0 if false?

Brian




T. Valko

How to combine "IF" functions
 
Try one of these:

=IF(L9="w1",5,IF(L9="w2",10,0))

=(L9="w1")*5+(L9="w2")*10

--
Biff
Microsoft Excel MVP


"BeeCee" wrote in message
a...
I have this function =IF(L9="w1",5,0) to test a cell for the text "w1" and
return value 10 if true, value 0 if false. This works as I want it to.

Now I want to test the same cell for text "w2" and return 10 if true. As
a stand-alone operation this would be =IF(L9="w2",10,0).

How can I combine these two functions in a single statement to test the
cell for either "w1" or "w2" returning either 5 or 10, and 0 if false?

Brian




Harlan Grove[_2_]

How to combine "IF" functions
 
"BeeCee" wrote...
....
How can I combine these two functions in a single statement to test the
cell for either "w1" or "w2" returning either 5 or 10, and 0 if false?

....

Another alternative that arguably extends to more cases more easily than the
other responses others have given.

=SUMPRODUCT((L9={"w1";"w2"})*{5;10})




All times are GMT +1. The time now is 09:36 AM.

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