+ Reply to Thread
Results 1 to 7 of 7

IF with 3 possible solutions

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    IF with 3 possible solutions

    Okay, I'm having trouble with this one. Here's what I want to do:

    column A is my projection, column B is my allocation. I can't exceed my allocation, and I can't have a negative value.

    In column C I want to put my value:
    If A1 is greater than B1, I want to put B1.
    If A1 is less than zero, I want to put 0.
    If A1 is less than B1 but is equal or greater than 0 I want to put A1.

    I tried to do it with an IF formula, but couldn't figure out how to get it with 3 possible results. Can anyone advise me?

    Thanks,
    John
    Last edited by jomili; 09-14-2010 at 08:42 AM.

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: IF with 3 possible solutions

    Maybe this...

    =IF(A1<0,0,IF(A1>B1,B1,IF(AND(A1<B1,A1>=0),A1)))
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: IF with 3 possible solutions

    Thanks Contaminated,

    You pointed me in the right direction. I used your formula, but whittled it down a little bit. This one seems to do the trick:
    =IF(A1<=0,0,IF(A1>=B1,B1,A1))
    If tested it with negatives and with amounts equal to or greater than B1, and it seems to be working correctly.

    Thanks for your help.
    John

  4. #4
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: IF with 3 possible solutions

    I suspect I could do it, but I was afraid of being another conditions where FALSE could be. Hope you understood.

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: IF with 3 possible solutions

    ooh, goog point! I didn't think about what would happen to the formula if a FALSE or #N/A shows up. I'll test that in the morning. Thank you!

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,979

    Re: IF with 3 possible solutions

    =median(a1,b1,0)
    Everyone who confuses correlation and causation ends up dead.

  7. #7
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: IF with 3 possible solutions

    Alright! Elegant, simple, easy to remember. I like that formula!

+ 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