cancel
Showing results for 
Search instead for 
Did you mean: 

Division by Zero Error

Former Member
0 Kudos

Post Author: WebbT

CA Forum: Formula

Using Crystal Professional 10.

Hope you can help. I am trying to calculate a % conversion and the formula below is bringin up the division by zero error. I have looked at a lot of articles on this problem but can't seem to work out how to amend it so that the error doesn't appear. This is obviously stopping users running the report and it is need quite urgently. If someone could explain in simple language it would be much appreciated.

Sum ({ACTIVITY.BUDGET}, {ACTIVITY.USERSTRING1}) / Sum ({@DealCount}, {ACTIVITY.USERSTRING1})

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Post Author: Murdoch

CA Forum: Formula

if Sum ({@DealCount}, {ACTIVITY.USERSTRING1}) = 0 then 0 else Sum ({ACTIVITY.BUDGET}, {ACTIVITY.USERSTRING1}) / Sum ({@DealCount}, {ACTIVITY.USERSTRING1})

Note that this does not give you a percentage - to get a percentaage, you would need to multiply the end result by 100. Or, you can use the built in percent operator:

if Sum ({@DealCount}, {ACTIVITY.USERSTRING1}) = 0 then 0 else Sum ({ACTIVITY.BUDGET}, {ACTIVITY.USERSTRING1}) % Sum ({@DealCount}, {ACTIVITY.USERSTRING1})