Formula fix

gtd526

Active Member
Joined
Jul 30, 2013
Messages
418
Office Version
  1. 2019
Platform
  1. Windows
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
Joined
Jun 12, 2014
Messages
62,265
Office Version
  1. 365
Platform
  1. Windows
Your formula needs to be
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),"")
 
Solution

gtd526

Active Member
Joined
Jul 30, 2013
Messages
418
Office Version
  1. 2019
Platform
  1. Windows
Your formula needs to be
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
Joined
Jun 12, 2014
Messages
62,265
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Forum statistics

Threads
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.
Allow Ads at MrExcel

Which adblocker are you using?

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
Top