countif Access 2000 - counting the number of values above 0

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

Guest

I,m trying to count how many numbers, in a column, that have a value greater
than zero. Any ideas anyone
 
In query design view, type something like this into a fresh column in the
Field row:
[MyField] > 0

Depress the Total button on the toolbar.
Choose Count under this field.

If you wanted to do it in code:
DCount("*", "MyTable", "MyField > 0")
 
Allen,
Pardon me, but since the result of MyField>0 will return true or false (or
null). Using Count will return a count of all the values of true and false.

I think what the poster needs is more like
Field: CountLarge: Abs(Sum([MyField]>0))
Totals: Expression

In SQL that would be

SELECT Abs(Sum([MyField]>0)) as CountLarge
FROM SomeTable

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Allen Browne said:
In query design view, type something like this into a fresh column in the
Field row:
[MyField] > 0

Depress the Total button on the toolbar.
Choose Count under this field.

If you wanted to do it in code:
DCount("*", "MyTable", "MyField > 0")

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Zab said:
I,m trying to count how many numbers, in a column, that have a value
greater
than zero. Any ideas anyone
 
Back
Top