+ Reply to Thread
Results 1 to 7 of 7

Two IF Statements in One Cell Returning Incorrect Results

Hybrid View

Shiks Two IF Statements in One Cell... 03-31-2011, 07:14 PM
Cutter Re: Two IF Statements in One... 03-31-2011, 07:24 PM
Shiks Re: Two IF Statements in One... 03-31-2011, 08:32 PM
Cutter Re: Two IF Statements in One... 03-31-2011, 08:40 PM
Shiks Re: Two IF Statements in One... 03-31-2011, 10:07 PM
AsifShabbir Re: Two IF Statements in One... 04-05-2011, 06:45 AM
Cutter Re: Two IF Statements in One... 04-05-2011, 09:27 AM
  1. #1
    Registered User
    Join Date
    03-31-2011
    Location
    U.P., MI
    MS-Off Ver
    Excel 2003
    Posts
    3

    Two IF Statements in One Cell Returning Incorrect Results

    Hello,

    I am trying to compare two columns, each with it's own condition and rank then for sorting later. Below is my statement:

    =IF(B4<$B$2,IF(C4<$C$2,0,1))
    The issue am having is that in some of the destination cells it gives me a "FALSE" result while in others, it outputs either "1" or "0", which is what I would like. I have tried modifying the statement after reading similar posts but I have been unsuccessful. I changed the reference cells to numbers, that didn't help ().

    Any help is greatly appreciated!

    P.S. I have attached a file
    Attached Files Attached Files
    Last edited by Shiks; 03-31-2011 at 10:13 PM. Reason: Problem solved :)

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Two IF Statements in One Cell Returning Incorrect Results

    Your IF() statement is lacking a condition.

    As you have it your statement is saying:

    IF B4<$B$2 do this IF(C4<$C$2,0,1)

    otherwise - this is what is lacking. So Excel simply says FALSE.

    Do you want some value if B4<$B$2 is TRUE but the IF(C4<$C$2,0,1) when it's FALSE.

    If so:

    =IF(B4<$B$2,"XXX",IF(C4<$C$2,0,1)) replace the "XXX" with the result you want when B4<$B$2 is TRUE

  3. #3
    Registered User
    Join Date
    03-31-2011
    Location
    U.P., MI
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Two IF Statements in One Cell Returning Incorrect Results

    Hi Cutter,

    Thank you for responding so quickly!

    I would like the statement to say that if both conditions are met (i.e. IF B4<$B$2 and IF C4<$C$2, then 0, else 1) then the result should be 0.

    I would like to sort based on the numbers 0 and 1. The strange thing is that the statement works (i.e. gives either 0 or 1) in some cells but then it doesn't in others (i.e. gives output 'FALSE).

    Thanks again for your help.

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Two IF Statements in One Cell Returning Incorrect Results

    OK, I thought that MAY have been what you wanted.

    Try:

    =IF(AND(B4<$B$2,C4<$C$2),0,1)

  5. #5
    Registered User
    Join Date
    03-31-2011
    Location
    U.P., MI
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Two IF Statements in One Cell Returning Incorrect Results

    It worked!!!!!
    Thanks Cutter!!! You're awesome, keep up the great work of helping sometimes frustrated Excel users like me

  6. #6
    Registered User
    Join Date
    03-02-2011
    Location
    England
    MS-Off Ver
    Excel 2013
    Posts
    34

    Re: Two IF Statements in One Cell Returning Incorrect Results

    Hi,

    I have same problem. I want in column G either of the following two conditions otherwise "N/A". Conditions are
    =IF(D3<=TODAY() + 42, "1") Column D is containing due date of a task so when It is 6 weeks before the due date I want "1" in Column G and
    =IF(H3=Date, "0") Wich means that when Column H has some date I want in Column G "0"
    If none of the conditions is met then there should be "N/A" in Column G

    Hoping favor from your side

    Thanks

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Two IF Statements in One Cell Returning Incorrect Results

    Please read the Forum Rules (click on the link at the top of the page).

    Pay particular attention to Rule #2.

    Once you have started your own thread you'll get the help you want.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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