# Divide by zero error in cell range

Hi,

I would like a formula modified to avoid getting divide by zero errors. The formula was kindly provided by a member yesterday however
since using on a new spreadsheet containing zeros it throws up the errors.
Please refer to attached spreadsheet   The zero is highlighted Sum-Probabilities-to-one-V2.xlsxin cell B17
Many thanks
Ian
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Excel & VBA ExpertCommented:
Hi Ian,

Try this Array Formula which requires confirmation with Ctrl+Shift+Enter instead of Enter alone.

In E2
``````=IFERROR(1/B2/ROUND(SUM((\$A\$2:\$A\$31=A2)*(\$B\$2:\$B\$31<>0)/IF(\$B\$2:\$B\$31=0,1,\$B\$2:\$B\$31)),2),0)
``````
0
retiredAuthor Commented:
Hi Neeraj,
I was wanting it to establish the probs and the sum of the range would add to 1.
You have corrected the divide by zero error but the formula needs adjusting.
Thanks
Ian
Sum-Probabilities-to-one.xlsx
0
Excel & VBA ExpertCommented:
Hi Ian,

I am not sure if I am getting you here.
Please look at the attached. The new formula is placed in column G and sum is placed in column H. What is missing in there?
Sum-Probabilities-to-one.xlsx
0
retiredAuthor Commented:
Worked okay, not sure what I did earlier as output was 1 for each cell.
However this formula is not practical for the 160,000 rows and 78 columns as it takes hours to calculate
despite my computer being high spec with an i9 16 core processor, 64 GB Ram and a 1TB Evo SSD
it maxes out my CPU and will need helper columns.
1
Excel & VBA ExpertCommented:
Yes, I agree. For that much of large data set, helper columns would be the best approach.
BTW good system configuration. I wish, one day I will have a system with same configuration. Let me know if you ever want to exchange your system with less powered system like mine. Lol
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

retiredAuthor Commented:
Thanks again Neeraj.
I think my computer is too heavy to ship :)
1
Excel & VBA ExpertCommented:
You're welcome Ian!

I think my computer is too heavy to ship :)
LOL...
0