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 » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Sum of field value based upon multiple instances of another value



 
 
Thread Tools Display Modes
  #1  
Old November 15th, 2009, 12:55 PM posted to microsoft.public.access.tablesdbdesign
NAHolmes
external usenet poster
 
Posts: 17
Default Sum of field value based upon multiple instances of another value

I have a table with the following fields:

ITEM
TOTAL
REF

The data is imported from Excel & the value in the ITEM field may be
repeated for an instance in the REF field.

So for 3 different REF values, the ITEM values may appear up to 3 times.

Is it possible to produce a query which will show the total for each ITEM,
rather than each instance?

Thanks in advance.
  #2  
Old November 15th, 2009, 10:43 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Sum of field value based upon multiple instances of another value

On Sun, 15 Nov 2009 03:55:01 -0800, NAHolmes
wrote:

I have a table with the following fields:

ITEM
TOTAL
REF

The data is imported from Excel & the value in the ITEM field may be
repeated for an instance in the REF field.

So for 3 different REF values, the ITEM values may appear up to 3 times.

Is it possible to produce a query which will show the total for each ITEM,
rather than each instance?

Thanks in advance.


Certainly. Create a Query based on the table; select the ITEM and TOTAL
fields. CHange the query to a Totals query by clicking the Greek Sigma icon
(summation sign, looks like a sideways M).

Leave the default GROUP BY for Item and change it to SUM for Total.

Since each row of the result will refer to three different REF values, you
shouldn't display that field - there are tricks if you need to do so.
--

John W. Vinson [MVP]
  #3  
Old November 16th, 2009, 11:31 AM posted to microsoft.public.access.tablesdbdesign
NAHolmes
external usenet poster
 
Posts: 17
Default Sum of field value based upon multiple instances of another va



"John W. Vinson" wrote:

On Sun, 15 Nov 2009 03:55:01 -0800, NAHolmes
wrote:

I have a table with the following fields:

ITEM
TOTAL
REF

The data is imported from Excel & the value in the ITEM field may be
repeated for an instance in the REF field.

So for 3 different REF values, the ITEM values may appear up to 3 times.

Is it possible to produce a query which will show the total for each ITEM,
rather than each instance?

Thanks in advance.


Certainly. Create a Query based on the table; select the ITEM and TOTAL
fields. CHange the query to a Totals query by clicking the Greek Sigma icon
(summation sign, looks like a sideways M).

Leave the default GROUP BY for Item and change it to SUM for Total.

Since each row of the result will refer to three different REF values, you
shouldn't display that field - there are tricks if you need to do so.
--

John W. Vinson [MVP]
.
Many thanks John. I guessed it would be something simple. I do indeed need to filter by the ref field, but I already have a series of other queries & a form to do that. I have just modified to relevant query for TOTALS & it works a treat.


Thanks again.
 




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 02:59 PM.


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