Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Option buttons (2002 - XP)

    Is there a function in Excel that will perform one of several actions depending on the value of a cell without using nested IFs? For example, if A1 can be any integer value from 1 to 4, and I want to do something with B1 depending on the value of A1, can I do it? If that is not clear, consider the following syntax for a

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Option buttons (2002 - XP)

    <P ID="edit" class=small>(Edited by sdckapr on 08-Jul-03 14:16. Added CHOOSE function)</P>You can use "boolean logic", though it functions pretty much the same as an IF:

    <pre>=+(A1=1)*B1*25+(A1=2)*B1/25+(A1=3)*(B1+C1)+(A1=4)*(B1-C1)</pre>


    Another thought:
    <pre>=choose(A1,B1*25, B1/25, B1+C1, B1-C1) </pre>

    This method I think can only use 29 choices

    Steve

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Option buttons (2002 - XP)

    The choose is similar to case (I don't know if your note came before OR after I edited my original.), though choose only works with intergers, case does NOT have to. In your example choose should be fine, as you should only get integers

    Steve

  4. #4
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Option buttons (2002 - XP)

    <P ID="edit" class=small>(Edited by Don_Sadler on 08-Jul-03 11:28. Didn't see the Choose function initially.)</P>Thanks Steve, that does work, of course. I like the "choose" option.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •