Formula fix

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
657
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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
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),"")
 
Upvote 0
Solution
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.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,051
Members
448,940
Latest member
mdusw

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
Back
Top