Counting Number of Times Data Appears

rowcpa

New Member
Joined
Aug 10, 2010
Messages
9
Hello,

New to this list. I am an Accountant who dabbles in Access but have never got into programing. I have an issue I think may require some coding.

I want to count and number each time a specific item appears in a field and return the results in a query.

For example I have a table with 8 records in the "Ref" field:

Ref
1234
2234
3234
4234
5234
6234
7234
7234

Note that "7234" apears twice.

After I run my query I want to see the following results:

Ref Count
1234 1
2234 1
3234 1
4234 1
5234 1
6234 1
7234 1
7234 2

Purpose - I am trying to create a key field. In real life the "Ref" field is a transaction reference number for a credit card and it is unique. But, our corporate card holders have the ability to allocate a specific transaction to multiple expense accounts, such a one hotel bill to room, meals, entertainment, etc. This allocation creates multiple instances of the same "Ref." I will use the query to again make each item unique.

Thanks.
 
Yes Joe, I messed it up. :)

Actually, with hindsight it seems simple enough that I should have known what I did wrong. In fact, this is such a logical and simple solution it almost seems like I should have thought of this without asking :)

In any case, the 2nd formula is working without any issues, excellent work.
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Actually, with hindsight it seems simple enough that I should have known what I did wrong. In fact, this is such a logical and simple solution it almost seems like I should have thought of this without asking
Been there and done that.
Sometimes you get in so deep, you can't see the forest for the trees!

Glad you got it all working.
 
Upvote 0
In case you are curious, I did help someone do this with Access VBA not too long ago (I don't know why I didn't remember that before - maybe that bike I accident I had last week affected my head more than I thought!).

Here is a link to that thread:
http://www.mrexcel.com/forum/showthread.php?t=479526
 
Upvote 0

Forum statistics

Threads
1,215,746
Messages
6,126,647
Members
449,325
Latest member
Hardey6ix

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