Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / May 2006

Tip: Looking for answers? Try searching our database.

sum a field with multiple criteria

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fipp - 31 May 2006 00:10 GMT
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?
fredg - 31 May 2006 00:48 GMT
> Obviously I am trying to do this in a report.
> I am trying to get a total # of times where the following occurance happens.
[quoted text clipped - 8 lines]
> 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]))
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

John Spencer - 31 May 2006 00:56 GMT
=Abs(Sum([pres]="com" Or [pres]="inc" Or [pres]="int"))

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

=Abs(Sum([pres] 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.
[quoted text clipped - 8 lines]
> Another question I have is if I wanted to get the sum of [pres] where it is
> not null?
Marshall Barton - 31 May 2006 02:38 GMT
[snip main question]
>> Another question I have is if I wanted to get the sum of [pres] where it is
>> not null?

    =Count(pres)

Signature

Marsh
MVP [MS Access]

John Spencer - 31 May 2006 13:17 GMT
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.

> [snip main question]
>>> Another question I have is if I wanted to get the sum of [pres] where it
>>> is
>>> not null?
>
> =Count(pres)
Marshall Barton - 31 May 2006 15:44 GMT
Good advice John, but make those head slaps gentle ones.  My
forehead is dented from too many hard head slaps  ;-)
--
Marsh

>DUH!!!  Forehead slap!  Of course.
>
[quoted text clipped - 4 lines]
>
>> =Count(pres)

>> [snip main question]
>>>> Another question I have is if I wanted to get the sum of
>>>> [pres] where it is not null?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.