A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

sumif function in Access query, possible?



 
 
Thread Tools Display Modes
  #1  
Old April 26th, 2010, 07:32 PM posted to microsoft.public.access.queries
Cam
external usenet poster
 
Posts: 253
Default sumif function in Access query, possible?

Hello,

I have a query I am trying to calculate the sum of qty if OprStatus equal 1,
but there is no sumif function in Access. What can I do to work around it?
Thanks
  #2  
Old April 26th, 2010, 07:44 PM posted to microsoft.public.access.queries
Bob Barrows
external usenet poster
 
Posts: 475
Default sumif function in Access query, possible?

Cam wrote:
Hello,

I have a query I am trying to calculate the sum of qty if OprStatus
equal 1, but there is no sumif function in Access. What can I do to
work around it? Thanks


TotalQty:SUM(IIF([OprStatus]=1.[qty],0)
--
HTH,
Bob Barrows


  #3  
Old April 26th, 2010, 08:02 PM posted to microsoft.public.access.queries
vanderghast
external usenet poster
 
Posts: 593
Default sumif function in Access query, possible?

If that is the only sum you want, you can bring OprStatus in the grid,
change the GROUP BY to WHERE, and add the criteria: = 1. I assume you
already have a Total query, if not, the SQL statement should look like:

SELECT SUM(something)
FROM somewhere
WHERE OpsStatus = 1



You can add a group by clause too, if required. As it is now, the whole
table is considered to be ONE group.



Vanderghast, Access MVP


"Cam" wrote in message
...
Hello,

I have a query I am trying to calculate the sum of qty if OprStatus equal
1,
but there is no sumif function in Access. What can I do to work around it?
Thanks


  #4  
Old April 26th, 2010, 08:07 PM posted to microsoft.public.access.queries
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default sumif function in Access query, possible?

Cam -

In query design you just need to add the field OprStatus and down in the
criteria row put a 1. Then the query will only return records where
OprStatus is 1. The query should have the Total row showing (if not, click
on the totals button in the query design toolbar. Then in this row, select
Sum for the field you want summed.

--
Daryl S


"Cam" wrote:

Hello,

I have a query I am trying to calculate the sum of qty if OprStatus equal 1,
but there is no sumif function in Access. What can I do to work around it?
Thanks

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:18 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.