+ Reply to Thread
Results 1 to 4 of 4

If B1>b2 But <b3,b1????

  1. #1
    Registered User
    Join Date
    10-05-2006
    Posts
    6

    If B1>b2 But <b3,b1????

    I want excel to return a value to a cell in which there are 3 posible choices so I don't think an IF statement will work. Here is the background.

    A customer's frieght rate is say 8% of the total sale but the customer has minimum freight of say $400, and a maximum rate of say $900.

    I have established a hidden worksheet that has all of the customers freight cost and other data that varies from customer to customer, so I have 3 cells with the MIN MAX and frieght rate percentage in them. I also have a cell (call it B1) with the result of a formula - =total sale*fgt rate...

    cells for discussion purposes are
    B1(total sale*Fgt rate)
    B2(MIN say 400)
    B3(MAX say 900)

    SO how do I....

    IF B1<B2,B2
    IF B2<B1,B2
    IF B1>B2 BUT <B3,B1


    Okay I am a man that has taught myself excel and not a real bright bulb so I'm not sure I explained this right. Can anyone help??

    John

  2. #2
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by JEE

    SO how do I....

    IF B1<B2,B2
    IF B2<B1,B2
    IF B1>B2 BUT <B3,B1


    Okay I am a man that has taught myself excel and not a real bright bulb so I'm not sure I explained this right. Can anyone help??

    John
    You're probably going to have to clarify slightly.

    IF B1<B2, B2 -> This covers all situations when B1 < B2.
    IF B2<B1, B2 -> This covers all situations when B1 > B2.

    So basically, that covers everything except B1 = B2 (which you haven't mentioned and will need to decide on) and means that for all situations you want the value in B2.

    Your third statement is:
    IF B1>B2 BUT <B3,B1 -> This is basically B1 is between B2 and B3, correct?

    Because your first two cover all situations except for equality, this last statement is probably the one you need to consider first.

    Based on that, I'd suggest the following statement: (The reason I've just put B2 for the second value for the IF statement is because your first 2 statements (the way you have put them) cover all remaining circumstances.

    = IF(AND(B2<B1,B1<B3),B1,B2)

    If you meant that B1 had to be between and could equal B2 and B3:

    = IF(AND(B2<=B1, B1<=B3),B1,B2)

    If you've not expressed your IF statements the way you meant to, you'll probably have to re-state them.

    Scott

  3. #3
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Sorry, I should have looked at your data. Then I would have understood what you meant.

    You want:

    B1<B2 -> B2
    B1>B3 -> B3
    B1 Between B2 and B3 -> B1

    Use:

    =IF(B1<=B2, B2, IF(B1>=B3, B3, B1))

    Scott

  4. #4
    Registered User
    Join Date
    10-05-2006
    Posts
    6

    Worked Scott TY

    worked great except that formula is at the bottom of an "order form" so until the customer enters something in the order form this till returns a MIN(B2) value... but that's ok. Thanks for the help

    John

+ 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