# If and or excel formula

#### pattih

##### New Member
I need help with this excel formula:
IF(AND(E3=0,F3=0),"-",IF(E3=F3,(E3/D3),IF(F3-F3=0,0,(E3-F3)/D3)))

What I am trying to have the formula do is:
if e3 and f3 are both 0 put a "-" in g3
if e3 = f3 then divide e3/d3 and put the % in g3
if e3-f3=0, then put a 0 in g3
and if none of the above are true that subtract e3 from f3 and divide by d3.

The first 3 statements seem to be working, but the last part is not working for me and I can't figure out what I have wrong in the formula.

Thank you for your help.

### Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
you are very close. The problem is the last IF. You have F3-F3=0 (Always true) when it should be E3-F3=0

The formula shows "F3-F3", which should be corrected to "E3-F3" and the revised formula would be :

=IF(AND(E3=0,F3=0),"-",IF(E3=F3,(E3/D3),IF(E3-F3=0,0,(E3-F3)/D3)))

Thank you very much for your help. I was able to get the formula to work now!

Replies
9
Views
266
Replies
1
Views
202
Replies
3
Views
131
Replies
9
Views
175
Replies
0
Views
105

Threads
1,203,069
Messages
6,053,351
Members
444,655
Latest member
didr

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

### Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back