#DIV/0! error

ApolloID

Well-known Member
Joined
Jun 8, 2010
Messages
769
Hi, i have this three situations:

A..................B.................C
355,626 54,882 -85%
0 20,662 #DIV/0!
-111,43 0 100%

In C i have this formula: =(B10-A10)/ABS(A10)
This formula calculates the diference between B1 and A1 as percentage.

I need a formula to give me the correct result in all three situations.
The first situation is correct. I need the formula for the last too.

Can this be done?
Thanks!
 
It's good.
I have a last problem. At least i hope so..
If i have this:
-15 0
the result is #DIV/0!
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Again, what answer do you want from this? bosco_yip's formula

=IF(B1=0,0,(B1-A1)/MAX(A1,B1))

will capture this and return zero. But I would modify it again to cater for -ve values in column B

=IF(B1=0,0,(B1-A1)/MAX((ABS(A1),ABS(B1)))

or my original

=(B1-A1)/MAX(ABS(A1),ABS(B1))

and possibly also

=ABS((B1-A1)/MAX(ABS(A1),ABS(B1)))

to return all results as +ve values.
 
Upvote 0

Forum statistics

Threads
1,215,856
Messages
6,127,362
Members
449,381
Latest member
Aircuart

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