How to count a field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If for example, I have a table that contains a column with values of 0, 1 or
2. How can I count how many records contain 0 in that field . . . how many
contain 1 on that field . . . etc?
 
Try this:

=Sum(Iif([MyFieldName] = 0, 1, 0) ' How many has a 0
=Sum(Iif([MyFieldName] = 1, 1, 0) ' How many has a 1
=Sum(Iif([MyFieldName] = 2, 1, 0) ' How many has a 2

Change MyFieldName for the name of your field

Mauricio Silva
 
Back
Top