1
votes

Google sheets ...

Have a dropdown list in cell A1 ... dropdown list has 2 options : yes, no.

I want to make cell A2 : if A1 = yes then A2 = 1% ... if A1 = no then A2 = 5%

no idea how to write the formula and syntax. any help appreciated.

1
Have you tried pretty much exactly what you wrote? =IF(A1="yes", "1%", "5%") (in A2). - BeUndead
I thought I could work it out for 3 variables but I can't (the syntax).... How about if I have 3 variables ? yes, no ... dk = 10% - tinytoes
Oh, sorry I missed the third option. See answers below. :) - BeUndead
you mean Florian's answer ? I used that one for 2, but don't know the syntax for 3 variables :) - tinytoes
If you're getting more complicated, then a neater approach is to use a Named Range (google the term for how if needed) defining values to expect ("yes", "no" and "do") to values to enter ("5%", "1%" and "10%"). Then, using your range, say lookupTable, have =VLOOKUP(A1, lookupTable, 2, FALSE) in A2. - BeUndead

1 Answers

1
votes

You can find the documentation for the IF function here. In your case you can put the following text/formula in cell A2:

=IF(A1="yes", "1%", IF(A1="no","5%",""))

If you want to use the numbers in some other formulas later, you might want to keep them as numbers, and simply format the cells. You can change the format by selecting the cell and in the menu clicking on Format -> Number -> Percent. In that case you can write the following in cell A2:

=IF(A1="yes", 0.01, IF(A1="no",0.05,""))