+ Reply to Thread
Results 1 to 8 of 8

Nested IF with different column but same row

  1. #1
    Registered User
    Join Date
    10-11-2013
    Location
    Sabah, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Nested IF with different column but same row

    Greetings to all Gurus,

    I have a question regarding this nested IF function. Is it possible to nest IF function with a different column? For example, normally we would do these as per below:
    IF(D12>=2,"0",IF(D12=1,"5",IF(D12=0,"10")))
    So I was thinking if the below would be possible:
    IF(D12>=2,"0",IF(D12=1,"5",IF(D12=0,"10",IF(E12>=1,"0"))))
    Is the Bold function possible? Sorry if this question has been mentioned before as I'm not really sure myself of what keywords to search for this. Do enlighten me. Thanks!
    Last edited by minerva; 10-11-2013 at 08:56 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,186

    Re: Nested IF with different column but same row

    Hi minerva, you can nest/check whatever you wish so long as the logic makes sense.

    In this case, if D2 is not, 2, 1, or 0, you check E2 for its value. No problem with that.

    I notice though that you don't have a false outcome which means that if none of the conditions are true, the formula will display FALSE.

    Regards, TMS
    Last edited by TMS; 10-11-2013 at 04:29 AM.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Nested IF with different column but same row

    welcome to the forum, minerva. yes you can. but question is how does that fit in? the IF formula works from left to right. when D12 is greater or equals to 2, it immediately returns you 0 (point to note: you can remove the double quotes because that's for text. IF(D12>=2,0,...). the IF formula stops right there. only when D12 is NOT greater or equals to 2, not equals to 1 & not equals to 0, it will then test if E12 is greater or equals to 1. so unless you are saying only when D12 is a negative AND E12 is greater or equals to 1, put 0.

    or if you have other intentions, you must use the AND or OR. if D12 >=2 AND E12>=1, put 0
    =IF(AND(D12>=2,E12>=1),0,IF(D12=1,5,IF(D12=0,10)))

    if D12 >=2 OR E12>=1 is:
    =IF(OR(D12>=2,E12>=1),0,IF(D12=1,5,IF(D12=0,10)))

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Registered User
    Join Date
    10-11-2013
    Location
    Sabah, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Nested IF with different column but same row

    Dear Gurus,

    Thanks a lot for the fast feedback. What I intended to do was what benishiryo exactly pointed out. I got stuck with function cause I have been putting AND instead of OR as I thought both conditions of the column should be satisfied. Thus, below work perfectly fine:

    if D12 >=2 OR E12>=1 is:
    =IF(OR(D12>=2,E12>=1),0,IF(D12=1,5,IF(D12=0,10)))

    Just for knowledge gaining though, why is it OR and not AND? Anyway, thanks a lot. Really grateful for this.

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Nested IF with different column but same row

    glad to help. =)

    the explanation or outcome is what i have told you:
    if D12 >=2 AND E12>=1, put 0
    if D12 >=2 OR E12>=1, put 0

    so the "why" is depending on what you want. AND means all conditions must be met. D12 MUST BE >=2. E12 MUST BE >=1. OR means as long as 1 condition is met, it's fine. that is to say that if D12 & E12 are both 1, the condition of D12 failed but E12 succeeded. so you'll still get 0 as the answer

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,186

    Re: Nested IF with different column but same row

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  7. #7
    Registered User
    Join Date
    10-11-2013
    Location
    Sabah, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Nested IF with different column but same row

    It's done. Thanks!

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,186

    Re: Nested IF with different column but same row

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Needing Help with Nested IF Statement for One OR Two Column Word Answers
    By marybarnes in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-16-2013, 07:15 PM
  2. [SOLVED] Iserror works on one column but not two in small nested formula
    By Philb1 in forum Excel General
    Replies: 8
    Last Post: 07-07-2012, 02:08 AM
  3. Replies: 4
    Last Post: 04-04-2011, 01:07 PM
  4. Nested Loops to match column data
    By dems in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2010, 06:10 PM
  5. Nested loop to divide adjacent row by column (?)
    By dems in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-18-2010, 12:24 PM

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