# Division by Zero

Hi there,

I am using the formula below to calculation the percentages. However, when I run the report, I am getting division by zero, which I am not sure whats causing it because I beleive all the conditions for zeros are already covered. Any ideas?

Thanks

If (Sum ({@Oct 07}, {@Item / Variant})) +  (Sum ({@Nov 07}, {@Item / Variant})) + (Sum ({@Dec 07}, {@Item / Variant}))  + (Sum ({@Jan 08}, {@Item / Variant})) + (Sum ({@Feb 08}, {@Item / Variant})) = 0 and (Sum ({@Oct Plan 07}, {@Item / Variant})) + (Sum ({@Nov Plan 07}, {@Item / Variant})) + (Sum ({@Dec Plan 07}, {@Item / Variant})) + (Sum ({@Jan Plan 08}, {@Item / Variant})) + (Sum ({@Feb Plan 08}, {@Item / Variant}))> 0
then "FES"
else if (Sum ({@Oct 07}, {@Item / Variant})) + (Sum ({@Nov 07}, {@Item / Variant})) + (Sum ({@Dec 07}, {@Item / Variant})) + (Sum ({@Jan 08}, {@Item / Variant})) + (Sum ({@Feb 08}, {@Item / Variant})) >0 and (Sum ({@Oct Plan 07}, {@Item / Variant})) + (Sum ({@Nov Plan 07}, {@Item / Variant})) + (Sum ({@Dec Plan 07}, {@Item / Variant})) + (Sum ({@Jan Plan 08}, {@Item / Variant})) + (Sum ({@Feb Plan 08}, {@Item / Variant})) = 0
then "SEF"
else if (Sum ({@Oct 07}, {@Item / Variant})) + (Sum ({@Nov 07}, {@Item / Variant})) + (Sum ({@Dec 07}, {@Item / Variant})) + (Sum ({@Jan 08}, {@Item / Variant}))+ (Sum ({@Feb 08}, {@Item / Variant})) = 0 and (Sum ({@Oct Plan 07}, {@Item / Variant})) + (Sum ({@Nov Plan 07}, {@Item / Variant})) + (Sum ({@Dec Plan 07}, {@Item / Variant})) + (Sum ({@Jan Plan 08}, {@Item / Variant})) + (Sum ({@Feb Plan 08}, {@Item / Variant})) = 0 then '1'
else
CStr (((Sum ({@Oct 07}, {@Item / Variant})) + (Sum ({@Nov 07}, {@Item / Variant})) +(Sum ({@Dec 07}, {@Item / Variant})) + (Sum ({@Jan 08}, {@Item / Variant}))+ (Sum ({@Feb 08}, {@Item / Variant})))/((Sum ({@Oct Plan 07}, {@Item / Variant})) + (Sum ({@Nov Plan 07}, {@Item / Variant})) + (Sum ({@Dec Plan 07}, {@Item / Variant}))+ (Sum ({@Jan Plan 08}, {@Item / Variant}))+ (Sum ({@Feb Plan 08}, {@Item / Variant})))  * 100)

ast2550

the last clause is the only place where you are dividing in this formula.

CStr (((Sum ({@Oct 07}, {@Item / Variant})) + (Sum ({@Nov 07}, {@Item / Variant})) +(Sum ({@Dec 07}, {@Item / Variant})) + (Sum ({@Jan 08}, {@Item / Variant}))+ (Sum ({@Feb 08}, {@Item / Variant})))/((Sum ({@Oct Plan 07}, {@Item / Variant})) + (Sum ({@Nov Plan 07}, {@Item / Variant})) + (Sum ({@Dec Plan 07}, {@Item / Variant}))+ (Sum ({@Jan Plan 08}, {@Item / Variant}))+ (Sum ({@Feb Plan 08}, {@Item / Variant})))  * 100)

And, you are sure that this is not equal to zero?

((Sum ({@Oct Plan 07}, {@Item / Variant})) + (Sum ({@Nov Plan 07}, {@Item / Variant})) + (Sum ({@Dec Plan 07}, {@Item / Variant}))+ (Sum ({@Jan Plan 08}, {@Item / Variant}))+ (Sum ({@Feb Plan 08}, {@Item / Variant})))  * 100)

Also, are you sure that each of you underlying formulas aren't dividing by zero instead of this one?

I don't beleive it should be equal to zero but there might be one or two cases where it could be zero....

No its only this formula thats dividing...