sum a field with multiple criteria

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

Guest

Obviously I am trying to do this in a report.
I am trying to get a total # of times where the following occurance happens.
[pres] = 'inc' Or 'com' Or 'int'

I tried the following and it worked:
=Abs(Sum([pres]="com"))

When I added the other results as follows it did not calculate properly:
=Abs(Sum([pres]="com" Or "inc" Or "int"))


Another question I have is if I wanted to get the sum of [pres] where it is
not null?
 
Obviously I am trying to do this in a report.
I am trying to get a total # of times where the following occurance happens.
[pres] = 'inc' Or 'com' Or 'int'

I tried the following and it worked:
=Abs(Sum([pres]="com"))

When I added the other results as follows it did not calculate properly:
=Abs(Sum([pres]="com" Or "inc" Or "int"))

Another question I have is if I wanted to get the sum of [pres] where it is
not null?

Ques 1):
=Sum(IIf([pres]="com",1,IIf([Pres] = "inc",1,IIf([Pres] =
"int",1,0))))

Ques 2):
=Sum(Nz([Pres]))
 
=Abs(Sum([pres]="com" Or [pres]="inc" Or [pres]="int"))

=Abs(Sum(IsNull([pres])=False))

=Abs(Sum([pres] Is Not Null))
 
DUH!!! Forehead slap! Of course.

I got locked into a method and just kept going. I try to avoid
preconceptions when developing a solution, but sometimes ...

Thanks for the correction.


Marshall Barton said:
John Spencer wrote:
[snip main question]
Another question I have is if I wanted to get the sum of [pres] where it
is
not null?


=Count(pres)
 
Good advice John, but make those head slaps gentle ones. My
forehead is dented from too many hard head slaps ;-)
--
Marsh

John said:
DUH!!! Forehead slap! Of course.

I got locked into a method and just kept going. I try to avoid
preconceptions when developing a solution, but sometimes ...

Thanks for the correction.


=Count(pres)
John Spencer wrote:
[snip main question]
Another question I have is if I wanted to get the sum of
[pres] where it is not null?
 
Back
Top