Divide by zero error in cell range

Ian Bell
Ian Bell used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Subodh Tiwari (Neeraj)Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015

Commented:
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)

Open in new window

Ian Bellretired

Author

Commented:
Hi Neeraj,
I was wanting it to establish the probs and the sum of the range would add to 1.
Please refer to attached sheet.
You have corrected the divide by zero error but the formula needs adjusting.
Thanks
Ian
Sum-Probabilities-to-one.xlsx
Subodh Tiwari (Neeraj)Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015

Commented:
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
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Ian Bellretired

Author

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.
Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015
Commented:
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
Ian Bellretired

Author

Commented:
Thanks again Neeraj.
I think my computer is too heavy to ship :)
Subodh Tiwari (Neeraj)Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015

Commented:
You're welcome Ian!

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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial