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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

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
355
Replies
6
Views
220
Replies
5
Views
262
Replies
4
Views
93
Replies
6
Views
92

1,141,130
Messages
5,704,452
Members
421,350
Latest member
jake9951

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.

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