If you are trying to run a formula against a form entry you will notice that Sheets blanks out the formula. Not cool.
Here is a nice and clean solution for you that uses ARRAYFORMULA and IFS.
ARRAYFORMULA
Enables the display of values returned from an array formula into multiple rows and/or columns and the use of non-array functions with arrays.
IFS function
Evaluates multiple conditions and returns a value that corresponds to the first true condition.