• Option buttons (2002 – XP)

    Author
    Topic
    #390184

    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

    Viewing 0 reply threads
    Author
    Replies
    • #692075

      (Edited by sdckapr on 08-Jul-03 14:16. Added CHOOSE function)

      You can use “boolean logic”, though it functions pretty much the same as an IF:

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

      Another thought:

      =choose(A1,B1*25, B1/25, B1+C1, B1-C1) 

      This method I think can only use 29 choices

      Steve

      • #692089

        (Edited by Don_Sadler on 08-Jul-03 11:28. Didn’t see the Choose function initially.)

        Thanks Steve, that does work, of course. I like the “choose” option.

        • #692091

          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

    Viewing 0 reply threads
    Reply To: Option buttons (2002 – XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: