# Formula fix

#### gtd526

##### Active Member
Hello,
It's a nested IF statement(4). If its false then "".
In the formula bar, when I click it shows (logical test, value if true, value if false), but its the last IF that doesn't give (value if false).
'If B20 & W20 >0, If B20 & W20 <0, If B20 <0 and W20 >0, If B20>0 and W20 <0.
Just adjusting the formula for positive and negative numbers (B20, W20).

IF(AND(EXACT(A20,AA20),B20>0,W20>0),(W20-B20),""),IF(AND(EXACT(A20,AA20),B20<0,W20<0),(W20*-1)-(B20*-1),""),IF(AND(EXACT(A20,AA20),B20<0,W20>0),(W20-(B20*-1)),""),IF(AND(EXACT(A20,AA20),B20>0,W20<0),(W20*-1)-B20)),"")

Thank You

### Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

#### Fluff

##### MrExcel MVP, Moderator
Excel Formula:
``=IF(AND(EXACT(A20,AA20),B20>0,W20>0),(W20-B20),IF(AND(EXACT(A20,AA20),B20<0,W20<0),(W20*-1)-(B20*-1),IF(AND(EXACT(A20,AA20),B20<0,W20>0),(W20-(B20*-1)),IF(AND(EXACT(A20,AA20),B20>0,W20<0),(W20*-1)-B20,""))))``
although It could be simplified to
Excel Formula:
``=IF(EXACT(A20,AA20),ABS(W20)-ABS(B20),"")``

#### gtd526

##### Active Member
Excel Formula:
``=IF(AND(EXACT(A20,AA20),B20>0,W20>0),(W20-B20),IF(AND(EXACT(A20,AA20),B20<0,W20<0),(W20*-1)-(B20*-1),IF(AND(EXACT(A20,AA20),B20<0,W20>0),(W20-(B20*-1)),IF(AND(EXACT(A20,AA20),B20>0,W20<0),(W20*-1)-B20,""))))``
although It could be simplified to
Excel Formula:
``=IF(EXACT(A20,AA20),ABS(W20)-ABS(B20),"")``
Thank you. Works perfectly.

#### Fluff

##### MrExcel MVP, Moderator
You're welcome & thanks for the feedback.

Replies
13
Views
361
Replies
6
Views
242
Replies
5
Views
266
Replies
4
Views
95
Replies
6
Views
93

### Forum statistics

1,141,410
Messages
5,706,292
Members
421,439
Latest member
JordsdoExcel ### 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.

### Which adblocker are you using?    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

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