Count Postive Numbers Only in a Form

O

Oscar

I have a form shows the number of days before and after date. So some numbers are a negative valve some a postive valve. I would like a way to count only the fields that have a positve valve.

=Count([field]<1) does not work. It returns all the fields, gives me the same result as =Count(*)
 
M

Michael Keating

Hi,

Not tested, but try

=sum(iif([field]<1, 0, 1))

that should give you a count of the number of positive values found
(treating zero as negative).

MFK.


Oscar said:
I have a form shows the number of days before and after date. So some
numbers are a negative valve some a postive valve. I would like a way to
count only the fields that have a positve valve.
=Count([field]<1) does not work. It returns all the fields, gives me the
same result as =Count(*)
 
F

fredg

I have a form shows the number of days before and after date. So some numbers are a negative valve some a postive valve. I would like a way to count only the fields that have a positve valve.

=Count([field]<1) does not work. It returns all the fields, gives me the same result as =Count(*)

You want to count positive numbers, but your criteria (<1) is for Zero
or negative numbers.
Anyway, don't count them Sum them:
=Sum(IIf([FieldName]>0,1,0))

You're adding 1 for every number greater than 0.
 

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