ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Nesting conditional statements (https://www.excelbanter.com/excel-discussion-misc-queries/232945-re-nesting-conditional-statements.html)

David Biddulph[_2_]

Nesting conditional statements
 
You've contradicted yourself. If A1 is neither 1 nor 2 nor 4, do you want
the answer to be 6 or 4 or 3?
--
David Biddulph

GARY wrote:
I need to test the contents of cell a1 for three values:

If a1 = 1 then 5, else 6
If a1 = 2 then 9, else 4
if a1 = 4 then 10, else 3

How do I nest the conditional statements?




David Biddulph[_2_]

Nesting conditional statements
 
No. You are still contradicting yourself. Please look again at what you
have written and think about what you have said.

In what condition does the 6 apply?
In what condition does the 4 apply?
In what condition does the 3 apply?
And hence in what condition does the 7 apply?
--
David Biddulph

"gcotterl" wrote in message
...
Is these better:

If a1 = 1 then 5, else 6
If a1 = 2 then 9, else 4
if a1 = 4 then 10, else 3
if a1 is not 1 or 2 or 4 then 7




David Biddulph[_2_]

Nesting conditional statements
 
Look in Excel help for the IF function.
--
David Biddulph

gcotterl wrote:
Hi David,

I can write one formula that tests one condition.
I can write several separate formulas each testing one condition.
But, apparently, I can't correctly "nest" several separate into one
statement.

Can you help me? (Ignore my examples and use decent examples).

Gary





All times are GMT +1. The time now is 07:19 PM.

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