Count Specific Data on report

vagues0ul

Registered User.
Local time
Today, 00:25
Joined
Sep 13, 2018
Messages
103
i am using switch statement on report to define a criteria. Here is the switch statemtn code i am using
Code:
=Switch([smttl]/[smmttl]*100>90,"A+",[smttl]/[smmttl]*100>=80,"A",[smttl]/[smmttl]*100>=70,"B+",[smttl]/[smmttl]*100>=60,"B",[smttl]/[smmttl]*100>=50,"C",[smttl]/[smmttl]*100>=40,"D",True,"F")

now i want to count how many of the data is A+ or in B's or in C's etc. what should i do to achieve the result like this

A's = 5
B's = 3
C's = 11 etc etc
 
Do that calculation in query. That will provide a field to use in defining a GROUPING section in report design. Or use that entire expression to define the group in report design. Then use Count(*) in textbox in group header.
 
Take a look at the DCount() Function. You would use it as the record source in an unbound field in the Footer section of your report.
 
If those grade boundaries will be reused in the future, I suggest you create a reference table with that information rather than using a lengthy switch statement.

Although using Switch is faster than IIf, referring to a table should be faster still.
If you have many records, it should be a noticeable improvement
 

Users who are viewing this thread

Back
Top Bottom