• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

conditionals

ahhhmed

Member
Hi,


In A2 I have a drop down list of 4 choices.

in A3 I want to put a formula that changes when the choice in A2 changes; eg

in A3 if the choise is CHOICE1 then the formula is ( sum b2:b5 ), if it is CHOICE2 then the formuls is (if B6=7,C7,""), etc. so that the formula changes with the change of the choices. How can do this?
 
Hi ,


Use the IF statement.


I assume that what you want in A3 is the result of the 4 different formulae , and not the formulae themselves i.e. if =SUM(B2:B5) gives a result of 37 , then when the first option in A2 is selected , then A3 should contain the value 37 , and not the text =SUM(B2:B5).


Assume that the choices in A2 are choice_1 , choice_2 , choice_3 and choice_4.


Assume your formulae are formula_1 , formula_2 , formula_3 , formula_4.


Your formula in A3 should be :


=IF(A2=choice_1,formula_1,IF(A2=choice_2,formula_2,IF(A2=choice_3,formula_3,formula_4)))


For example , you have said :


formula_1 is =SUM(B2:B5)


formula_2 is =IF(B6=7,C7,"")


Replace these formulae in the above template :


=IF(A2=choice_1,SUM(B2:B5),IF(A2=choice_2,IF(B6=7,C7,""),IF(A2=choice_3,formula_3,formula_4)))


Note that the inner IF do not have the "=" sign.


Narayan
 
Back
Top