Divide By Zero Error

Dearster

New Member
Joined
May 17, 2011
Messages
20
I'm trying to calculate the average percentage of a rolling 28 days and running year however when using SUM and COUNT it is coming up with a #Div/0! error and therefore not letting me calculate the rolling 28 day average or yearly average unless each week has a value in it. How can I get around this?

Thanks.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Can you post the formula that works when there is data in all cells, and a sample set of data?
 
Upvote 0
=SUM(B13;F13;J13;N13;R13;V13;Z13;AD13;AH13;AL13;AP13;AT13;AX13)/COUNTIF(B13;F13;J13;N13;R13;V13;Z13;AD13;AH13;AL13;AP13;AT13;AX13,">0")

although that produces an Err:508

The normal SUM/COUNT produces a #DIV/0!


Period 1 Period 2 Period 3
Week 1 Week 2 Week 3 Week 4 Week 1 Week 2 Week 3 Week 4 Week 1 Week 2 Week 3
Sunday 23.00% 100.00% 100.00% 100.00% %
Monday 100.00% 23.00% 23.00% 100.00%
Tuesday 23.00% 100.00% 85.00% 100.00%
Wednesday 100.00% 100.00% 100.00% 100.00%
Thursday 100.00% 100.00% 100.00% 100.00% 43.00%
Friday 100.00% 100.00% 100.00% 100.00%
Saturday 100.00% 100.00% 100.00% 100.00%

Week To Date 78.00% 89.00% 86.86% 100.00% #DIV/0! #DIV/0! #DIV/0! #DIV/0! #DIV/0! #DIV/0! 43.00%

Period To Date 88.46% #DIV/0! 43.00%

Year To Date Err:508
 
Upvote 0
Try this array formula entered with CTRL + SHIFT + ENTER

This will still error if NONE of the cells have a value in it.
But it works fine if at least 1 cell is populated.

=AVERAGE(IF(MOD(COLUMN(B13:AX13),4)=2,IF(B13:AX13>0,B13:AX13)))


IMPORTANT
This is an array formula
After entering the formula, highlight the cell with the formula and press F2
Then press CTRL + SHIFT + ENTER
When entered correctly, the formula will be enclosed in {brackets}


Hope that helps.
 
Upvote 0
Or email anyone the spreadsheet that may be able to help? It's a very small spreadsheet. Nothing too complicated.
 
Upvote 0
OpenOffice Calc doesn't use commas for argument separators. Try this version of jonmo1's formula:

=AVERAGE(IF(MOD(COLUMN(B13:AX13);4)=2;IF(B13:AX13>0;B13:AX13)))

You still need to confirm with Ctrl-Shift-Enter.
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,881
Members
452,948
Latest member
Dupuhini

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