Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Average Calculation Division By Zero 1

Status
Not open for further replies.

nerdlinger

Programmer
Apr 8, 2001
14
US
I took the advice of an earlier response by KH and I am almost there. I am receiving a divison by zero error now.

Here is what I have done thus far. This takes place in a group. Thanks,This forum has been most helpful
--------------------------
First determine the value of the record(it works)

Formula Name:myValQ2
Val({ReportData.q2})
--------------------------

Then sum The values in the group (it works)
Formula Name:myValTotalQ2
Sum({@myValQ2},{ReportData.consultant})

----------------------------

Then Start a counter (it works)
Formula Name:TotalQ2
If{@myValQ2} > 0
Then 1
else 0
-----------------------------
Then Get the total count of TotalQ2 (it works)
Formula Name:GrandTotalQ2
Sum({@TotalQ2},{ReportData.consultant})

------------------------------

Here is where it's broken--Division By Zero Error
Formula Name:AverageQ2

{@myValTotalQ2}/{@GrandTotalQ2}
 
Try:

if {@GrandTotalQ2} = 0
then 0
else {@myValTotalQ2}/{@GrandTotalQ2} Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top