Need to calculate about 8 textboxes on a form by adding 4 and dividing by the sum of the other four

Need to calculate about 6 textboxes on a form by adding 4 and dividing by the sum of the other four

Some of the textboxes are blank and causing a #Num! error.  I am currently using this formula:

=CDbl(Nz((CDbl(Nz([vol1],0))+CDbl(Nz([vol2],0))+CDbl(Nz([vol3],0))/=CDbl(Nz([time1],0))+CDbl(Nz([time2],0))+CDbl(Nz([time3],0))+CDbl(Nz([time4],0))
deer777Asked:
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.

Ryan ChongCommented:
you got extra = there?

=CDbl(Nz((CDbl(Nz([vol1],0))+CDbl(Nz([vol2],0))+CDbl(Nz([vol3],0))/=CDbl(Nz([time1],0))+CDbl(Nz([time2],0))+CDbl(Nz([time3],0))+CDbl(Nz([time4],0))

quick try:

=CDbl(Nz((CDbl(Nz([vol1],0))+CDbl(Nz([vol2],0))+CDbl(Nz([vol3],0))/CDbl(Nz([time1],0))+CDbl(Nz([time2],0))+CDbl(Nz([time3],0))+CDbl(Nz([time4],0)) 

Open in new window

0
Ryan ChongCommented:
you may also consider to put brackets in your calculation:

=( CDbl(Nz((CDbl(Nz([vol1],0))+CDbl(Nz([vol2],0))+CDbl(Nz([vol3],0)) ) / ( CDbl(Nz([time1],0))+CDbl(Nz([time2],0))+CDbl(Nz([time3],0))+CDbl(Nz([time4],0)) )
0
deer777Author Commented:
Sorry but I get #Num! and #Div/0! errors on both of the fixes above
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

deer777Author Commented:
Was getting sums on the ones that had numbers in them but #Num! errors on the blank textbox sums  (without the extra = in the calc)
0
Gustav BrockCIOCommented:
Try using Val and Nz:

=(Val(Nz([vol1]))+Val(Nz([vol2]))+Val(Nz([vol3]))+Val(Nz([vol4]))) / (Val(Nz([time1]))+Val(Nz([time2]))+Val(Nz([time3]))+Val(Nz([time4])))

Open in new window

0
deer777Author Commented:
Still need help. . . have not solved this issue yet
0
Gustav BrockCIOCommented:
Or, if sum of time can be zero:

=(Val(Nz([vol1]))+Val(Nz([vol2]))+Val(Nz([vol3]))+Val(Nz([vol4]))) / IIf(Val(Nz([time1]))+Val(Nz([time2]))+Val(Nz([time3]))+Val(Nz([time4]))=0, 1, Val(Nz([time1]))+Val(Nz([time2]))+Val(Nz([time3]))+Val(Nz([time4])))

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

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

Start your 7-day free trial
deer777Author Commented:
Val and Nz give me the same result as with CDbl and Nz - I get sums on several and the ones that the sums are 0 on either the vol or time side, I get the #Num! error.  So the issue seems to be that I am getting an error on the division with 0 on either side (vol or time) with the #Num! error
0
Gustav BrockCIOCommented:
That can't be true, as Val returns 0 for Nz(Null) and for any string. Also, the IIf divides be 1 if the sum of time is zero.

So something in your end is not as you think it is, like different naming of fields or controls. Also, the name of the control mut be different of any of the control uses in the calculation.
0
deer777Author Commented:
Gustav Perfection!!!

You solved it!!
0
Gustav BrockCIOCommented:
Great!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.