Crystal Reports If Then

Posted on 2009-02-13
Last Modified: 2013-12-11
I am trying to figure out a formual in Crystal reports that will do the following.  I have a commission report set up for salespeople.  I have the report grouped by salesperson.  The report basically shows the salesperson, what sales are eligble for commission, the sale amount and the commission pay amount.  I want to add a bonus to the commission pay if the salesperson sales exceed a specific number.  The issue is i want that sales amount and bonus amount to be diffrent for each salesperson.  The below works but i need to be able to add other if then statements to the formual to account for diffrent sales and bounus numbers.

if (salesperson)='johndoe' and (salesamount)>100000 then (compay)+500 else compay

How would i fix this to add 'janedoe' when her sales go over 150000 she gets a 1000 bonus?
Question by:jnikodym
    LVL 10

    Accepted Solution

    if (salesperson)='johndoe' and (salesamount)>100000 then (compay)+500 else
    if (salesperson)='janedoe' and (salesamount)>150000 then (compay)+1000 else
    if (salesperson)='billybob' and (salesamount)>200000 then (compay)+2000 else
     etc.etc.etc (for each salesperson)
    else compay

    Author Comment

    thank you dougvarga
    LVL 100

    Expert Comment

    That solution doesn't work as you desire it.  If Jane makes over 100000 the bonus is 500
    You need to test in the other order.  Highest amount first

    If if (salesperson)='johndoe' then
       if (salesamount)>150000 then
       else if (salesamount)>100000 then
    else if (salesperson)='billybob' then
       if (salesamount)>170000 then
       else if (salesamount)>120000 then
    etc.etc.etc (for each salesperson)


    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
    As an accountant it is essential that I am able to provide accurate and timely information to management and staff.  One of the challenges that I have faced is the need to report on a time period, whether it be a month, quarter, or year, and wanting…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    733 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now