Solved

Crystal Reports 8.5 Division By Zero Error Message

Posted on 2007-04-11
3
2,111 Views
Last Modified: 2009-12-16
I currently running Crystal Reports 8.5
I am getting a Division By Zero error on the following code.

({INVENTOR.PRICE_CODE_1} - {INVENTOR.UNIT_COST}) / {INVENTOR.UNIT_COST} * 100

The code above is being used as a formula field {@Percent}
What gives?
0
Comment
Question by:CarloVasquez
  • 2
3 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 125 total points
ID: 18890211
Apparently you have a product with unit-cost of 0

Try this
if {INVENTOR.UNIT_COST} = 0 then
   0
else
   ({INVENTOR.PRICE_CODE_1} - {INVENTOR.UNIT_COST}) / {INVENTOR.UNIT_COST} * 100

mlmcc
0
 
LVL 42

Assisted Solution

by:frodoman
frodoman earned 125 total points
ID: 18890215
If unit cost is zero you'll get this error.  Change your formula to this:

if {INVENTOR.UNIT_COST} = 0 then
   0
else
   ({INVENTOR.PRICE_CODE_1} - {INVENTOR.UNIT_COST}) / {INVENTOR.UNIT_COST} * 100;

That should handle the problem.

frodoman
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18890753
Glad i could help

mlmcc
0

Featured Post

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question