Count Postive Numbers Only in a Form

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

Guest

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(*)
 
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(*)
 
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.
 
Back
Top