Countif formula help please

F

ferde

I am trying to build a query that gives me the count of records in a field
that have a value range between 40 and 51. The formula I've tried is
returning the total number of records. I can see I have the wrong formula
but not sure how to correct it ..any help would be greatly appreciated.

Count(IIf([heartrate]>=40,[heartrate]<=51,0))
 
D

Duane Hookom

Sum(Abs([heartrate] Between 40 and 51))

The expression [heartrate] Between 40 and 51 will return either -1/True or
0/False. Summing the Absolute value of this expression actually counts the
number of records returning true.
 
A

Allen Browne

Try:
=Sum(iif([heartrate] between 40 and 51, 1, 0)

Make sure this text box is in the Report footer or a Group footer (not in
the Page footer.)
 

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