Number Based on Instance of Value

CPGDeveloper

Board Regular
Joined
Oct 8, 2008
Messages
174
Hi Everyone~

There must be a simple way to do this -- If I have a table as follows:

Field1
A
A
A
B
B
B

I want to create a field that counts the instances of the value in Field 1...something like this --

Field1, Field2
A,1
A,2
A,3
B,1
B,2
B,3

Any help would be greatly appreciated. Thanks.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
The reason there really isn't a "simple" way to do this, is because it isn't really an relational database type of thing. By definition, records in a table in a relational database are supposed to be totally unrelated to each other, meaning that order should really have no meaning (hence, this is more of an "Excel" type of task than an "Access/database" type of task).

However, there are ways of doing it, though you will need to write the SQL code directly, as it involves nesting queries.
See: number records in a group, within access query
 
Upvote 0
Very helpful, thanks -- I thought perhaps there might have been some Access function I didn't know about...I was able to figure it out using SQL. Thanks!

The reason there really isn't a "simple" way to do this, is because it isn't really an relational database type of thing. By definition, records in a table in a relational database are supposed to be totally unrelated to each other, meaning that order should really have no meaning (hence, this is more of an "Excel" type of task than an "Access/database" type of task).

However, there are ways of doing it, though you will need to write the SQL code directly, as it involves nesting queries.
See: number records in a group, within access query
 
Upvote 0

Forum statistics

Threads
1,213,530
Messages
6,114,162
Members
448,554
Latest member
Gleisner2

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