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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Division by Zero Error 2

Status
Not open for further replies.

YANKRAY

Technical User
Nov 7, 2003
283
Crystal Reports 10.0

I am using a formula to determine cost per item. I divide the total cost by the Quantity to get this value.

Some of the items have a Quantity, but no total Cost.

Crystal gives me a "Division by Zero" error when using this formula:

if({BI_INVENTORY_VALUE.COST} / {BI_INVENTORY_VALUE.QUANTITY}) = 0 then
0.00 else {BI_INVENTORY_VALUE.COST} / {BI_INVENTORY_VALUE.QUANTITY}

How can I write the formula so I will not get the error?

Thanks,
Ray
 
Try this

Code:
if {BI_INVENTORY_VALUE.QUANTITY} = 0 then
0.00 else {BI_INVENTORY_VALUE.COST} / {BI_INVENTORY_VALUE.QUANTITY}

-lw
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top