Excel formula help for auto populate

Copper Contributor

This is what I am trying to so we have 4 predfined values for column 'A' 

For example (P,Q,R,S)

and I want a formula to be automatically inserted in the Column 'B' as per the option I choose in column 'A' 

For example:

P = x+y

Q = x-y

R = x*y

S = x/y

 

so if i choose 'P' in a cell in column 'A'

in column 'B' in adjacent cell the formula 'x+y' should be auto populated.

 

Any help would be highly appreciated.

 

Note: New in excel and using Microsoft Excel for MAC version 16.21.1

2 Replies
Hi,

This should work,=IF(A1="P","x+y",IF(A1="Q","x-y",IF(A1="R","x*y", IF(A1="S","x/y"))))
As an alternative to Nested IFs, you may use CHOOSE, as follows:
=CHOOSE(MATCH(A1,{"P","Q","R","S"}),
"x+y","x-y","x*y","x/y")