i wrote this in Basic Syntax, not Crystal Syntax. I think what you are doing can be accomplished by grouping and doing running totals, but here is a function code none the less that will do it.
Global x1 As String
Global y1 As Number
Global y2 as Number
x1 = {Field that contains data to count}
if x1 = "Item1 to count for" then y1 = y1 + 1
if x1 = "Item2 to count for" then y2 = y2 + 1
formula = ToText (y1) + "= Name of Item1 " + ToText (y2) + "= Name of Item2"
The above code is good if your are only looking at 1 field, if you are looking at multiple fields such as these:
How many Horror and Zombie were there?
How many Musical and Rock were there?
Horror, Zombies
Horror, Aliens
Horror, Demons
Musical, Classical
Musical, Pop
Musical, Rock
Global x1 As String
Global x2 as String
Global y1 As Number
Global y2 as Number
x1 = {Field that contains Main data to count} 'ex. horror
x2 = {Field that contains Sub data to count} 'ex. Zombies
if (x1 = "Item1 Main" and x2="Item1 Sub) then y1 = y1 + 1
if (x1 = "Item2 Main" and x2="Item2 Sub) then y2 = y2 + 1
formula = ToText (y1) + "= Name of Item1 " + ToText (y2) + "= Name of Item2"