+ Reply to Thread
Results 1 to 8 of 8

How to combine two IF statements together.

  1. #1
    Registered User
    Join Date
    03-12-2009
    Location
    Oxford, uk
    MS-Off Ver
    Excel 2003
    Posts
    10

    How to combine two IF statements together.

    hey guys
    need some help
    i need to combine two if statements together.
    the two if statements are below

    =IF(Sheet3!$E$9=Main!I2:I41,1,0)

    =IF(Sheet3!$E$13=Main!I2:I41,-1,0)

    Any help will be appreciated

    thanks

    foad
    Last edited by foad; 03-12-2009 at 04:41 PM.

  2. #2
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: How to combine two IF statements together.

    Please Login or Register  to view this content.
    The only problem I see...is that if E9 AND E13 BOTH equal Main!I2:I41 - then the result will always be a "1" since the first criteria was met and never got to the false portion to check the second criteria. You really can't get around this in one formula since you are comparing two seperate cells to the same field and haven't dictated a priority of one IF statement over another in the situations where both criteria are met. In the formula above, I did dictate the E9 criteria as the primary...but you could switch it around if you wanted the E13 criteria instead...but you do need to choose one over the other to dictate what to do if both criteria are true.
    Last edited by GuruWannaB; 03-12-2009 at 01:42 PM.

  3. #3
    Registered User
    Join Date
    03-12-2009
    Location
    Oxford, uk
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How to combine two IF statements together.

    Hey pal

    thanks for the formula.. it worked

    i understand the reason you gave me why it would work.

    but for some reason it did

    so once again thank you

    Ledge

  4. #4
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: How to combine two IF statements together.

    Oh...it will work...but what I was trying to say...is that if E9 AND E13 were both equal to the Main!I2:I41 - and you wanted it to result with a "-1" instead of a "1" - then you would need to re-prioritize the IF statements. But glad to help!
    I help because of the Pavlovian dog that resides in the inner me...so if you are happy with the results, please add to my reputation. It helps keep me motivated!



    Please mark your threads as Solved once it is solved. Check the FAQ's to see how.

  5. #5
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: How to combine two IF statements together.

    This doesn't make sense, your IFs refer to ranges, am I missing something?

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to combine two IF statements together.

    Maybe you want to check if the value is within those ranges?

    e.g

    Please Login or Register  to view this content.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  7. #7
    Registered User
    Join Date
    03-12-2009
    Location
    Oxford, uk
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How to combine two IF statements together.

    dont worry about it guys, thanks for your help
    there was two drop down boxes, start city, end city
    what i wanted to happen was when user selects the start city ($E$9),
    it would look up that city in the range (L2:L200).
    when it found it, it would put a 1 next to it and if not a zero, and the same for the other if statement.

    so once again thanks for all your help and guruwannabe for a very quick response.

  8. #8
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: How to combine two IF statements together.

    it won't work that way...

+ 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