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!

Countif or Sumif in Crystal reports?

Status
Not open for further replies.

leetprog

Programmer
Jan 27, 2004
12
BE
Hello,
Is there a function that counts a certain field based on a condition?
f.e. I need to count how many times a card has been used: How many cards have been used where the card = 4.

In excell there is a function called countif or sumif. How can I do this in Crystal reports?

TIA
 
Create a formula :

If {card} = 4 then 1 else 0

replace the item in bold with your field.

Placse this on the report, right click, insert summary, SUM.

Hope this helps....

Reebo
UK

Please Note - Due to current economic forcast and budget constraints, the light at the end of the tunnel has been switched off. Thank you for your cooperation.
 
Hi, thx for replying
it still doesn't work, with this formula i get the totaal number of cards. I need to how many card there are with number 4 or number 2.

GRTZ
 
Then modify the formula:

If {card} in [4,2] then 1 else 0

Then insert a simple sum for this formula. Do NOT do a count, a count will count every record, including zeros.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top