Access Equivalent to Excel's COUNTIF function??

CliffHanger9

zigga zigga
Local time
Today, 10:10
Joined
Nov 1, 2004
Messages
20
HI All-

The title sorta sums this one up..

What is the best way in Access 2000 (expression builder) to replicate the COUNTIF functionality of Excel

In case you are not familiar with this, it essentially scans a field and counts the number of a specified instance.

So my text box calculates the number of days since a date so the values look like:

12
356
234
47
182
25
93
...any positive number basically. What I am trying to do in another text box (this is all on a report, by the way) is count the number of instances where the value is less than 45 days.

From this number I will determine what percentage of the entire list that count is (if there were 100 rows, and 22 of them had values less than 45 days, this text box would return 22%)

Any help would be appreciated with either bit!!!!!!!
THANKS!!!!!!!!!!!!!!
 
Pat Hartman said:
=Sum(IIf(YourValue < 45, 1, 0))

Hi Pat - thanks for responding and confirming that i have not lost my sanity
this is the formula i am using which produces the #Error message:

=Sum(IIf([txtDaysSinceLastLogin]<46,1,0))

any other thoughts?
 
If txtDaysSinceLastLogin refers to a calculated control rather than a bound field, you'll need to repeat the calculation inside the function.

=Sum(IIf(([a] + ) * [c] < 46,1,0))
 
Pat Hartman said:
If txtDaysSinceLastLogin refers to a calculated control rather than a bound field, you'll need to repeat the calculation inside the function.

=Sum(IIf(([a] + ) * [c] < 46,1,0))



like this?

=Sum(IIf((Now()-[KLIXLAST_LOGIN])<46,1,0))

...?


#Error :(

KLIXLAST_LOGIN is a field bound to a table - date datatype.
thanks though
 

Users who are viewing this thread

Back
Top Bottom