Avoid div/0 error?

MsCynic

Board Regular
Joined
May 21, 2006
Messages
122
Hi guys, when dragging a cell down to repeat a formula throughout a column, what is the trick that avoids having the #DIV/0! error display on rows without data in them?

Thanks in advance,
C
 
In a macro,

if IsNumeric(denominator) and CDbl(denomiator)=0 then ... will protect your formula.

On a spreadsheet

=IF(iserror(a1/b1),"",a1/b1) will return the emptrystring rather than a #DIV/0 errror.
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
In =IF(B1,A1/B1,"")

Can you explain the 1st bit. =IF(B1, I have used IFs before but am used to having a condition at the start e.g. =IF(b1>0

Cheers
 
Upvote 0
0 evaluates to FALSE in the conditional part of an IF.

IF(b1,a1/b1,"")

is the same as IF(NOT(b1=0),a1/b1,"") in this case.
 
Upvote 0

Forum statistics

Threads
1,215,374
Messages
6,124,567
Members
449,171
Latest member
jominadeo

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