# basic help with =IF function

#### no skills

##### New member
I am looking for a way to have an error % formula change based on an selection from a drop down menu. I found the =IF function and tried writing it based on examples found but I can't get it working. Basically, if the output unit is mA, then I need an error % based on a range of 4 - 20, otherwise my range is the user entered range at the top of the sheet (this is all highlighted in red text on the file provided). I'm sure this is a basic problem but I'm just starting to use excel. Any input is appreciated.

#### Attachments

• Help copy.xlsx
29.3 KB · Views: 18
Which formula cells are you referring to, I cannot see any referring to J26.

Sorry Bob, the formula I wrote is in cell E29 and is

=IF(J26=ISTEXT(mA),(((C29-12)/16)*100),(((C29-(A29-A28))/(A29-A28)*100)))

I was also wondering if I could also chain several 'IF's together and have it so if a particular section is not used I would be able to get rid of the #DIV/0 warnings. Thank you for your interest in this.

Is this what you need?

=IF(J26="mA",(C29-12)/16*100,(C29-(A29-A28))/(A29-A28)*100)

You can use the IF function to error check your formulas in this manner.

- In cell E37 your formula

Code:
``=((C37-A37)/A37)*100``

will have a division error if the denominator is zero, so change the formula to:

Code:
``=IF(A37=0,"",((C37-A37)/A37)*100)``

for a blank, or:

Code:
``=IF(A37=0,0,((C37-A37)/A37)*100)``

for a zero.

Thanks for the help guys, that did the trick. Unfortunately I do have to be able to show the deviation from zero as a percentage of the range so I couldn"t use your formulas CheshireCat, but your examples got me on the right path and I figured out what I needed. Thanks again.