Counting Based on the Data Content

P

Public

Hi,
I have a group footer and I am counting based on the values in the fields.
So, for example, I will have a count of Math courses, Phys courses etc. for
each semester. I have tried making a count similar to
=COUNT(CourseType='Phys')
but it counts ALL courses.

How can I write conditioanl counts?
 
A

Allen Browne

Try summing instead of counting:
=Abs(Sum([CourseType] = "Phys"))

the expression evaluates to True (-1) or False or Null.
Summing the Trues gives the negative count.

If you find it easier:
=Sum(IIf([CourseType] = "Phys", 1, 0)
 
M

Marshall Barton

Public said:
I have a group footer and I am counting based on the values in the fields.
So, for example, I will have a count of Math courses, Phys courses etc. for
each semester. I have tried making a count similar to
=COUNT(CourseType='Phys')
but it counts ALL courses.


What is the report grouped on? If it's on CourseType then
the count would just be =Count(*)

OTOH, if each group includes many CourseType values, then
you would probably be better off using a subreport based on
a Totals type query that counts records by CourseType.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top