what if formula excel

Copper Contributor

i need a formula which says the following 

 

if cell x =30  then return a value in cell reference a28 

if cell x =60 then return a value in cell reference b28

if cell x = 90 then return a value in cell reference c28

 

if neither of those 3 conditions are met then return value 0 zero 

1 Reply
Try:

=SWITCH(cell x, 30, A28, 60, B28, 90, C28, 0)

Or for older Excel versions:

=IF(cell x = 30, A28, IF(cell x = 60, B28, IF(cell x = 90, C28, 0)))