Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • August 28, 2016, 03:50:30 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Excel If Then Statements  (Read 4453 times)

Mizraim

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 150
    • View Profile
    • Donate to Member
Excel If Then Statements
« on: March 21, 2009, 11:10:01 AM »
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.

There has to be something that I'm either missing or just doing wrong. Please help. Thanks in advance.

Mizraim

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 150
    • View Profile
    • Donate to Member
Re: Excel If Then Statements
« Reply #1 on: March 21, 2009, 11:43:03 AM »
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?
« Last Edit: March 21, 2009, 11:48:11 AM by Mizraim »

AndyM

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 616
    • View Profile
    • Donate to Member
Re: Excel If Then Statements
« Reply #2 on: March 21, 2009, 07:41:54 PM »
Quote
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.

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.

dasadler

  • Supporting Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
Re: Excel If Then Statements
« Reply #3 on: March 21, 2009, 11:47:15 PM »
Try the following formulas:

In F2, type: =if(d2="fire","NW","")

In G2, type: =if(d2="fire","W","")