Help Modifying a Formula - eliminate #DIV/0! result

easybpw

Active Member
Joined
Sep 30, 2003
Messages
407
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
Hello! Thanks in advance for all the help. This board has been great over the years. I have this formula, =SUM($B$23:$B$31)-SUM($A$19:$B$19)/COUNTBLANK($B$23:$B$31), and it works like I intended except for one small issue. If there are no blank cells when the countblank function starts the result is #DIV/0!. How can I eliminate the #DIV/0! result? I would prefer the answer to the formula to be a -0- in the cell but will accept an empty cell as well.

Thanks again!

Bill
 

Some videos you may like

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

AhoyNC

Well-known Member
Joined
Oct 10, 2011
Messages
4,725
Office Version
  1. 365
Platform
  1. Windows
If you are using Excel 2007 or later you can use the IFERROR function.

Code:
=IFERROR(SUM($B$23:$B$31)-SUM($A$19:$B$19)/COUNTBLANK($B$23:$B$31),0)

If you are using Excel 2003 look at the ISERROR function.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,535
Messages
5,602,217
Members
414,513
Latest member
junbuggle

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