To get the sum for the same category in the same month (Access Query)

Apple08

Active Member
Joined
Nov 1, 2014
Messages
450
Hi everyone

I have a problem here to get the sum of the same category in the same month:

Month GpName Name Cal1 Cal2
01/08/2015 Red Mary 1 20
01/08/2015 Red John 2 21
01/08/2015 Green Jack 3 22
01/08/2015 Green Simon 4 23
01/08/2015 Yellow Jo 5 24
01/08/2015 Yellow Will 6 25
01/09/2015 Red Mary 7 26
01/09/2015 Red John 8 27
01/09/2015 Green Jack 9 28
01/09/2015 Green Simon 10 29
01/09/2015 Yellow Jo 11 30
01/09/2015 Yellow Will 12 31
01/10/2015 Red Mary 13 32
01/10/2015 Red John 14 33
01/10/2015 Green Jack 15 34
01/10/2015 Green Simon 16 35
01/10/2015 Yellow Jo 17 36
01/10/2015 Yellow Will 18 37

I would like to create a formula in Access query, so as to sum up the same GpName in the same month and get the percentage as below: Sum of gpName Red (1 + 2)/(20 + 21) = 7%

Results
01/08/2015 Red 3 41 7%
01/08/2015 Green 7 45 16%
01/08/2015 Yellow 11 49 22%

Please could anyone help? Many thanks.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Like this:
Rich (BB code):
SELECT [Month]
	,GpName
	,sum(cal1)
	,sum(cal2)
	,sum(cal1) / sum(cal2)
FROM table
GROUP BY [month]
	,gpname
 
Upvote 0
Thanks Kyle, do I add them into the Access query or they are VBA codes? I am new to Access, please help me to understand it.
 
Upvote 0

Forum statistics

Threads
1,215,047
Messages
6,122,858
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top