Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I'm so glad I found this site... Now I can get some sleep, because my problem is solved..."

Geography

Where in the world do Tek-Tips members come from?
Charlessm (TechnicalUser)
5 Apr 11 18:18
I have a formula that helps with my division by 0 issue.  Whenever I preview the report with data, everything comes out just fine.  But when I try to export the report to excel, the division by 0 message pops up with the formula workshop.  Is there something I'm missing?  I am by no means an expert at crystal reports, any assistance would be appreciated.  
 
crystalkiwibruce (Programmer)
6 Apr 11 0:15
Check your formulas.  

If you have {field1} / {fieldb}

replace with
if {fieldb}=0 then 0 else
{field1} / {fieldb}

that should remvoe any divide by zero errors.  I suspect the error is on a subsequence page.  Preview only shows the first page while Export processes all pages.
Charlessm (TechnicalUser)
6 Apr 11 9:30
Hi crystalkiwibruce.  Thanks for your reply.  As I mentioned below, I already have a formula.  I've copied below.

whileprintingrecords;
if {@Gross Profit} <>0 then
{@Gross Profit}/Sum ({@Sales}, {LineItem.ItemID}) *-100
else 0

When I hit View > Print Preview, I can see all records and data.  But when I try to export to excel, I'll get the division by 0 error message.  I originally input the formula when I got the message when trying to Print Preview.  I'll need another way to fix this.  Thanks.
 
kray4660 (MIS)
6 Apr 11 10:34
Checking that {@Gross Profit} is non zero will not avoid the divide by zero error.  You should check to see if Sum ({@Sales}, {LineItem.ItemID}) is zero.

whileprintingrecords;
if Sum ({@Sales}, {LineItem.ItemID} <>0 then
{@Gross Profit}/Sum ({@Sales}, {LineItem.ItemID}) *-100
else 0
 
Charlessm (TechnicalUser)
6 Apr 11 10:39
Kray4660,

Worked perfectly!  I'm still pretty new to this, a great learning experience. Thanks.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close