+ Reply to Thread
Results 1 to 10 of 10

Nested IF formula - problem

  1. #1
    Registered User
    Join Date
    04-03-2008
    Posts
    14

    Nested IF formula - problem

    TO summarize, I am trying to compare numbers in 2 columns (Q and X). If the first number (Q) is positive, I want to compare it to the second number (X) to see if it is also positive. If the second number (X) is also positive, then I want to print "W", otherwise I want to print "L".

    I want to do the same with a negative number in column Q and see if column X is also negative, but that is where I am running into problems - nesting a second IF statement that will accomplish that. I have tried to do it a number of ways, and have encountered errors each time.

    Here is what I have so far, very simple as you can see:

    Please Login or Register  to view this content.
    Thanks for your help all!
    Last edited by DUAL; 11-26-2008 at 04:15 AM.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    So if both values are >0 print W and if they are both <0 what should be printed?
    What is the result if none of these conditions is met?

  3. #3
    Registered User
    Join Date
    04-03-2008
    Posts
    14
    Quote Originally Posted by arthurbr View Post
    So if both values are >0 print W and if they are both <0 what should be printed?
    What is the result if none of these conditions is met?
    Same if they are both negative, print a W. if the first is a negative but the second is not, then print a L.

    I'm not sure what you mean by "if none of these conditions is met" could you please explain a little further?

    Thanks!

    edit: I think I know what you mean now, if none of the conditions are met, that is if any of the cells has a 0 instead of a positive or negative number, then print a "P" instead of a "W" or an "L"

    Thanks!
    Last edited by DUAL; 11-25-2008 at 04:18 AM.

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    =IF((or(and(q41<0,x41<0),AND(Q41>0,X41>0)),"W","L")

  5. #5
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    And a little shorter =IF(Q41*X41>0,"W","L")

  6. #6
    Registered User
    Join Date
    04-03-2008
    Posts
    14
    Quote Originally Posted by arthurbr View Post
    And a little shorter =IF(Q41*X41>0,"W","L")
    aha! i knew there had to be a mathematically simple and obvious way to do this, but couldnt wrap my brain around it. thank you very much sir!

  7. #7
    Registered User
    Join Date
    04-03-2008
    Posts
    14
    Quote Originally Posted by arthurbr View Post
    And a little shorter =IF(Q41*X41>0,"W","L")
    Is there an easy way to add on a part that would print a "P" if the value equals zero? Thanks again.

  8. #8
    Registered User
    Join Date
    11-24-2008
    Location
    Moscow, Russia
    MS-Off Ver
    MS Office 2003, 2007
    Posts
    90
    DUAL, I'm sorry I didn't quite get, why you can't use nested IF function like this:

    =IF(Q41*X41=0,"P",IF(Q41*X41>0,"W","L"))

  9. #9
    Registered User
    Join Date
    04-03-2008
    Posts
    14
    Quote Originally Posted by Freaky_zoid View Post
    DUAL, I'm sorry I didn't quite get, why you can't use nested IF function like this:

    =IF(Q41*X41=0,"P",IF(Q41*X41>0,"W","L"))
    Works great, thank you very much!

  10. #10
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    You are welcome. Can you now kindly mark your thread as Solved?

    Edit your original post
    Click Go Advanced
    Select [Solved] from the drop down where it says [No Prefix]
    Click Submit

+ 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