4 Replies Latest reply: May 15, 2014 9:55 AM by aardvark _

# Nested If

How do you write a nested if?

If (TC=395 .And. R="", amount,if(TC=362 .And. R="",-1*amount, if(TC=395 .And. R="R", etc etc

• ###### Nested If

Your example above will work fine, as long as you're careful to put all the closing parentheses at the end.

Originally posted by MorseB:

How do you write a nested if?

If (TC=395 .And. R="", amount,if(TC=362 .And. R="",-1*amount, if(TC=395 .And. R="R", etc etc /b[/quote]

• ###### Nested If

I keep getting operand count error message.  What does that mean?

• ###### Nested If

Beth,

Something's not quite right.

See if  [url="http://mails.datawatch.com/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=4;t=000066#000000"]this[/url] helps at all

Originally posted by MorseB:

I keep getting operand count error message.  What does that mean? /b[/quote]

[size="1"][ May 19, 2006, 01:27 PM: Message edited by: Todd Niemi ][/size]

• ###### Nested If

Does your last if have both a true and a false value?

e.g.

If (val=1, A, If (val=2, B, If (val=3, C, If (val=4, D, E[/b] ))))

Each nested if is the false value for the previous if, but the last if needs an actual value for the false part.