Totals if fist 2 character match.

dbazzelle

New Member
Joined
Dec 4, 2003
Messages
38
Hello I have some data that looks something like this:

00text
00text
01text
03text
etc...

text=any alpha numeric value.

what i need to do is a total (count) of those values if the first two charecters match.

in this example i would need:

00=2
01=1
03=1

Thanks,
David
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Go Into the Design view of the query. Add the Table that contains your data. Click on the sigma (E) symbol to add the total line to the grid.
Place this in the first grid.

Field: Field2: Left([FieldwithData],2)
Total: GroupBy

Place this in the second grid:

Field: Count: [Field2]
Total: Count

In SQL it is:

SELECT Left([FieldwithData],2) AS Field2, Count([Field2]) AS [Count]
FROM Table
GROUP BY Left([FieldwithData],2);


HTH,
CT
 
Upvote 0

Forum statistics

Threads
1,221,614
Messages
6,160,839
Members
451,673
Latest member
wella86

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