Excel User Group
Microsoft Excel blogs, forums, files. Read, ask questions, provide answers.

Excel 2007 help

Latest post Tue, Apr 22 2008 2:05 AM by jackgopher. 8 replies.
  • Fri, Mar 14 2008 10:48 AM

    • Bsimons
    • Not Ranked
    • Joined on Fri, Mar 14 2008
    • Posts 1
    • Points 53

    Excel 2007 help

    I have the following cenerio and not sure what function to use. I am a new user and any help would be appreciated.

     

    IF A1=26.75 then the value returned to B2 is 75

    IF A1=20.00 then the value returned to B2 is 45

    IF A1=18.00 then the value returned to B2 is 40

    IF A1=17.50 then the value returned to B2 is 40

     

    The value of A1 will always be one of these four values. Thank you in advance for your help.

     

     

    • Post Points: 53
  • Fri, Mar 14 2008 3:57 PM In reply to

    • Nick Hodge
    • Top 10 Contributor
    • Joined on Sun, Dec 23 2007
    • Southampton
    • Posts 304
    • Points 5,058
    • MVP

    How about nested IFs?

    =IF(A1=26.75,75,IF(A1=20,45,IF(A1=18,40,IF(A1=17.5,40,"Invalid"))))

    Regards
    Nick Hodge
    Microsoft MVP, Excel
    Southampton, UK

    Filed under: ,
    • Post Points: 5
  • Sat, Mar 15 2008 4:12 AM In reply to

    • Roger Govier
    • Top 10 Contributor
    • Joined on Wed, Jan 9 2008
    • Abergavenny, South Wales, UK
    • Posts 60
    • Points 1,017
    • MVP

    If A1 will definitely be one of those values, you could use

    =75-(A1<26.75)*30-(A1<20)*5

    Regards Roger Govier Microsoft Excel MVP
    • Post Points: 37
  • Wed, Apr 9 2008 4:12 AM In reply to

    • blue_sphinx
    • Top 25 Contributor
    • Joined on Thu, Mar 27 2008
    • Phils/UAE
    • Posts 26
    • Points 434

  • Here are other way that you could come up with that values:

    A1 = Conditional

    B1 = Resulting Value

    You could placed for B1 formula is: =LOOKUP(F14,{17.5,18,20,26.75},{40,40,45,75})

    Hope this could help!

    Blue

    • Post Points: 5
  • Wed, Apr 9 2008 4:14 AM In reply to

    • blue_sphinx
    • Top 25 Contributor
    • Joined on Thu, Mar 27 2008
    • Phils/UAE
    • Posts 26
    • Points 434

    Wink Sorry its = LOOKUP(A1,{17.5,18,20,26.75},{40,40,45,75}.

     

    • Post Points: 5
  • Fri, Apr 18 2008 2:25 PM In reply to

    • jackgopher
    • Top 150 Contributor
    • Joined on Fri, Apr 18 2008
    • Posts 2
    • Points 26

    Roger, can you explain a little how you've come with your formula? Was it complicated to get to it? can most or any "nested ifs" based on one cell be transofrmed in such a formula?

    I would have used Nick's formula, if not this, then that, if not this, then that.... but yours seems sophisticated.

    Regards,

    Jack Gopher

    • Post Points: 21
  • Fri, Apr 18 2008 9:16 PM In reply to

    • br7250
    • Top 25 Contributor
    • Joined on Fri, Apr 4 2008
    • Virginia, USA
    • Posts 34
    • Points 458

     Create a table consisting of 2 columns and 4 rows as follows:

    17.50     40

    18.00     40

     20.00    45

    26.75     75

    Name this range NumbersTwo

    go to cell B2 and enter: =vlookup(A1,NumbersTwo,2,false)

    Solved. 

    Regards,

    Bruce Reynolds

    Excel Power User and Model Developer

    • Post Points: 5
  • Mon, Apr 21 2008 6:13 PM In reply to

    • Roger Govier
    • Top 10 Contributor
    • Joined on Wed, Jan 9 2008
    • Abergavenny, South Wales, UK
    • Posts 60
    • Points 1,017
    • MVP

    Hi Jack
    Sorry for the dealy in response, but I have been away at the MVP Summit in Seattle, without my computer.

    The formula breaks down as follows.

    The highest value it could be is 75, when A1 = 26.75
    If A1<26.75, then the value need to be 45, which is 30 lower than 75
    (A1<26.75) will either return True or False. When Multiplied by a number, the True is coerced to 1, and the False is coerced to 0
    If it is True, then (A1<26.75)*30 equals 1 * 30 and this value will be taken from 75 to give a result of 45
    If it is False then (A1<26.75)*30 will result in 0 * 30, hence the value will stay at 75.

    Continuing on, the test for whether the value is <20, will return similar true or false results, and multiplying the result * 5, will give the further deduction to end up with 40. I chose 20 arbitraly as a value which was above 18 and 17.5. You could have used <=18.


    This works because a value of 17.5, for example, is both less than 26.75, therefore 30 is deducted, AND is less than 20, so a further 5 is deducted.

    There are many instances where you can use this logic in place of IF statements.
    Hope the expalantion helps.

    Regards Roger Govier Microsoft Excel MVP
    • Post Points: 21
  • Tue, Apr 22 2008 2:05 AM In reply to

    • jackgopher
    • Top 150 Contributor
    • Joined on Fri, Apr 18 2008
    • Posts 2
    • Points 26

    Thanks a lot Roger, Now I understand it!

    Jack

    • Post Points: 5
Page 1 of 1 (9 items) | RSS
Copyright Excel User Group and the relevant contributors, 2008. All Trade Marks acknowledged. This site is a peer-to-peer site and NOT affiliated in any way to Microsoft Corp. All rights reserved.