ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > Living Room

Excel If Then Statements

(1/1)

Mizraim:
I've searched a few sites for help on this matter, with no luck. So I figured I'd come ask you smart folks if you know what I'm doing wrong.

IF Cell D2 has the value "Fire" THEN Cell F2 receives "NW" AND Cell G2 receives "W", ELSE Put nothing in the box, shown in my code below

=if((D2="Fire"),F2="NW"&G2="W","")

However, I always get "False" Returned to the cell I put this code into.

Mizraim:
I figured it out, thanks to the help from my brother. I was taking the IF statement out too far. In an IF, there can only be 3 parts, the STATEMENT, the TRUE and the FALSE. I was adding 4.

=IF(D2="Fire",            "NW",         IF(D2="Wind","SE","")) is correct,
1                      2                       3

=IF(D2="Fire",            "NW",          "",             IF(D2="Wind",SE,"")) was incorrect
1                       2             3                               4

However, I am still unable to edit multiple cells in the same statement...

This was done from Cell F2:

=IF(D2="Fire","NW"&G2="W",IF(D2=...

Now it fills the G2 Cell with W and leaves False in F2.

Any pointers?

AndyM:
However, I am still unable to edit multiple cells in the same statement...

This was done from Cell F2:

=IF(D2="Fire","NW"&G2="W",IF(D2=...

Now it fills the G2 Cell with W and leaves False in F2.

--- End quote ---

To have G2 display something using a formula, you have to put a formula in G2.  I can't see how a formula in F2 would "fill the G2 Cell with W" unless you had a formula in G2 testing for the contents of F2 or D2.

The only way something in F2 can change the contents of G2 independent of what's already in G2, like a formula, is with an event macro.