Help with counting info in a database

Riaang

Board Regular
Joined
Aug 29, 2002
Messages
146
Hi, any help wil be appreciated. I have a lot of columns in my database but I want to work on these columns only. What I need is to add subtotals to the below. Eg after each membership number starting with 143 I want the count of all the Ben Type Code = to PM and the all that does not = to PM. Tha same goes for all the numbers starting with 144 and so on.

Member Number Ben Type Code
14300000931 PM
14300000831 SPO
14300000842 PM
14300820002 STU
14300820800 CHI
14400000739 PM
14400280022 PM
14400280022 SPO
14400200284 PM

My result for the above should be.
143 PM = 2
143 Not PM = 3
144 PM = 3
144 Not PM = 1.

Thanks.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hullo. Well, you should be able to get close to your desired goal if you design a report that has a grouping level based on LEFT(3,[Member Number]), and have two group totals PM and Non-PM.

HTH (y)

P
 
Upvote 0
This should do the trick


SELECT Left([member],3) AS FIRSTTHREE, IIf([BEN]="PM","PM","NOTPM") AS BENtype, Count(Tabel1.BEN) AS COUNTBEN
FROM Tabel1
GROUP BY Left([member],3), IIf([BEN]="PM","PM","NOTPM");

I've called your table(Tabel1) and your fields different Change them accordingly

Greetings Monkey
 
Upvote 0
Hi Monkey,

Sorry for sounding stupid but how and where do I use it in access?

Regards
 
Upvote 0

Forum statistics

Threads
1,221,618
Messages
6,160,873
Members
451,674
Latest member
TJPsmt

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