• Status: Solved
• Priority: Medium
• Security: Public
• Views: 3620

# Crystal Reports - Countif

How to countIf a field = to a certain criteria.
My questions (Crystal 9).  I am working on a report where I have to count the number of instances in a fields.  Example: Field A; total of number X's, Total number of Y's in that field, Total numer of Z's.  I have tried using the countif FieldA = "X", which works in Excel but evidently not in Crystal.
-Do I have to group first?
-If so, I do not want the group to show on the report, just the group totals.
-Is there a code such as "countif" that I can use instead of grouping?
Thanks
0
syhctl
1 Solution

Commented:
You need to create a formula first, and then summarize the formula.

So your formula would look something like this:

//@X
if {table.field} = "X"
then 1
else 0

You can then go to the Insert menu, choose Summary.
Pick this formula, then sum, then the location where you want to summary to be.
Repeat for each different condition you need to summarize.
0

Author Commented:
Thanks so much..
0

## Featured Post

Tackle projects and never again get stuck behind a technical roadblock.