Count occurence of a value in a field

Jon von der Heyden

MrExcel MVP, Moderator
Joined
Apr 6, 2004
Messages
10,907
Office Version
  1. 365
Platform
  1. Windows
Hello again

Today I have a table with a column called 'Concat'. This column contains multiple values. I have an update query and I want to update another column with the occurence # of the corresponding 'Concat' value. What do you think is the best approach?

Just to demonstrate this is how I would do it in excel:

Excel Workbook
AB
1ConcatOccurence
21700000023/2006-51601
31700001149/2006-51601
45106264863/2006-51601
55106264863/2006-51602
65106266720/2006-51601
75106267549/2006-51601
85106367910/2006-59131
95106367910/2006-59132
105106367910/2006-59133
115106367993/2006-59131
125106367993/2006-59132
135106368651/2006-59131
145106368652/2006-59131
155106368653/2006-59131
165106368654/2006-59131
175106368656/2006-59131
185106368656/2006-59132
195106368658/2006-59131
Index
Excel 2003
Cell Formulas
RangeFormula
B2=COUNTIF($A$2:A2,A2)
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi Jon, the quickest way to do this in Access is to create a Totals query.

1. New query, using the table of interest
2. Add Concat to the grid twice. Click just before the second and type Occurrences: (with the colon). This aliases the field, giving it a different name.
3. Click the Totals icon (the big Sigma). You'll see a new row in the grid. Keep the first as Group By; change the second to Count.
4. Run the query to get your summary. If you want to filter for duplicated values only, go back to design view and type >1 in the Criteria row for the field.

If you like you can update another table; alternatively, just run this query each time you need an update. Pushing the data elsewhere effectively snapshots it, but if the underlying data changes you need to re-run the Update query.

If I missed the point, let me know ;)

Denis
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,396
Messages
6,119,268
Members
448,881
Latest member
Faxgirl

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