+ Reply to Thread
Results 1 to 5 of 5

Nested IF formula problem

  1. #1
    Registered User
    Join Date
    10-25-2010
    Location
    Saskatchewan, Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Nested IF formula problem

    Hi,

    I am trying to create an IF formula that will make it so that the words "Ahead of Schedule, "On Schedule", or "Behind Schedule" will be displayed in a cell based on whether a number in another cell is positive, negative, or zero.

    The cell that the positive or negative number is in has a formula that calculates the number by subtracting one cell from another.

    The formula is =IF(AG2="","",AF2-AG2)


    The nested IF formula I'm using is:


    =IF(AK3<0,"Behind Schedule",IF(AK3>0,"Ahead of Schedule",IF(AK3="","","On Schedule")))


    This nested IF formula seems to work as long as there is No other formula in column AG calculating the positive or negative number.

    When the formula in column AG is there, the nested IF formula always gives me an "Ahead of Schedule", even when the cell is blank.

    I want the cell that would display whether a project was ahead or behind schedule to be BLANK if there is no number for it to use but it's not working!!

    If anyone can help me, I would greatly appreciate it.

    Thanks in advance.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Nested IF formula problem

    Hi Perrier, welcome to the forum. I'd suggest testing for the blank first, and then your other values. If this doesn't work, try posting a copy of your workbook so we can see what we're dealing with. Thanks.

    =IF(AK3="","",IF(AK3<0,"Behind Schedule",IF(AK3>0,"Ahead of Schedule","On Schedule")))

    Hope that helps!

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Nested IF formula problem

    Hello,

    the IF statement stops evaluation as soon as a TRUE is reached. Test the cell with the empty string and you will see that =AK3>0 evaluates to TRUE, even if it contains only a "" string.

    Change the order of your IF statement to test for "" first, then for >0

    =IF(AK3<0,"Behind Schedule",IF(AK3="","","On Schedule",IF(AK3>0,"Ahead of Schedule","On Schedule")))

  4. #4
    Registered User
    Join Date
    10-25-2010
    Location
    Saskatchewan, Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Nested IF formula problem

    Testing for the blank first worked!!

    Thanks a lot, Paul! I greatly appreciate it!

  5. #5
    Registered User
    Join Date
    10-25-2010
    Location
    Saskatchewan, Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Nested IF formula problem

    Thanks for explaining how the IF statements work, teylyn!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1