Formula to Overcome #DIV/0!

szbierski

New Member
Joined
Mar 12, 2009
Messages
2
:confused:I require a formula that needs to solve a couple of different calculations and this is the starting point of the formula I have used:

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

What I would like it to do is that if B1 & A1 are both 0, then answer should be 0. If A1 has a value that is not 0, then use B1/A1. This can be resolved by my current formula

The next bit is the tricky bit. If A1 is 0 and B1 is greater than zero, the answer is 1, if B1 is less than 0, the answer is -1.

Please help
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Sign refers to either positive or negative values
A positive number like 8 can also be represented as +8 with a "+" sign indicating that the 8 is indeed positive.
A negative number like -9 is usually written with a "-" sign indicating that the 9 is indeed negative.

I hope this helps.
 
Upvote 0
Sign refers to either positive or negative values
A positive number like 8 can also be represented as +8 with a "+" sign indicating that the 8 is indeed positive.
A negative number like -9 is usually written with a "-" sign indicating that the 9 is indeed negative.

I hope this helps.

Thanks for the reply and explanation. After rummaging through this message board for a couple of years. That's the first time I seen it used in a formula.
 
Upvote 0
From the help file:

SIGN function

Determines the sign of a number. Returns 1 if the number is positive, zero (0) if the number is 0, and -1 if the number is negative.
 
Upvote 0
From the help file:

SIGN function

Determines the sign of a number. Returns 1 if the number is positive, zero (0) if the number is 0, and -1 if the number is negative.

Thanks. You're right. It's in the Insert Function List too. Sometimes the most obvious place to look is last place you look. It through me off because I just had never seen it used before.
 
Upvote 0

Forum statistics

Threads
1,213,506
Messages
6,114,025
Members
448,543
Latest member
MartinLarkin

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