Assign a badge/ID for reapted the same records under condition

Jorgi

Board Regular
Joined
Jul 7, 2021
Messages
55
Office Version
  1. 2019
Platform
  1. Windows
Hello, I'm looking for a way (formula or macro) to assign ID or batch number under condition e.g., if the same records (AAA) in the same column is repeated 20 times or more then the first 10 repeated records (AAA) will get ID: A1 and the others over 10 and more will get ID: A2 but if the same record is not repeated more than 20 times in one same column then all the records will get ID: A1. Thank you for any help
 

Attachments

  • Batch.JPG
    Batch.JPG
    43.4 KB · Views: 14

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Here's a start, but how do you determine what the ID number will be for each unique record? IE: What ID does BBB get? CCC? DDD?
Book1
ABCDE
1AAAA1AAAA1
2AAAA1AAAA1
3AAAA1AAAA1
4AAAA1AAAA1
5AAAA1AAAA1
6AAAA1AAAA1
7AAAA1AAAA1
8AAAA1AAAA1
9AAAA1AAAA1
10AAAA1AAAA1
11AAAA2AAAA1
12AAAA2AAAA1
13AAAA2AAAA1
14AAAA2AAAA1
15AAAA2AAAA1
16AAAA2
17AAAA2
18AAAA2
19AAAA2
20AAAA2
21AAAA2
22AAAA2
23AAAA2
24AAAA2
25AAAA2
26AAAA2
27AAAA2
28AAAA2
29AAAA2
30AAAA2
Sheet2
Cell Formulas
RangeFormula
E1:E15,B1:B30E1=IF(COUNTIF(D:D,D1)<20,"A1",IF(AND(COUNTIF(D:D,D1)>=20,COUNTIF($A$1:D1,D1)<=10),"A1","A2"))
 
Upvote 0
Here's a start, but how do you determine what the ID number will be for each unique record? IE: What ID does BBB get? CCC? DDD?
Thank you, in case BBB, CCC, DDD... ZZZ it will be the same logic e.g., ZZZ ID: Z1 for all if reapeted less than 20 times and if ZZZ is repeated more than 20 times then first 10 ZZZs ID Z1 and over 10 and more ID:Z2. In one the same column can be mixture of the reapeated records so not only AAA can be AAA to ZZZ.
 
Upvote 0
Okay, how about this:
Book1
AB
169VVVV1
170NNNN1
171PPPP1
172VVVV1
173EEEE1
174FFFF1
175UUUU1
176IIII1
177JJJJ1
178AAAA1
179YYYY1
180AAAA1
181QQQQ1
182CCCC1
183OOOO1
184CCCC1
185QQQQ1
186GGGG1
187HHHH1
188QQQQ1
189EEEE1
190RRRR1
191LLLL1
192OOOO1
193TTTT1
194HHHH1
195MMMM1
196EEEE1
197VVVV2
198RRRR1
199QQQQ1
200OOOO1
201VVVV2
202WWWW1
Sheet2
Cell Formulas
RangeFormula
B169:B202B169=IF(COUNTIF(A:A,A169)<20,LEFT(A169,1)&"1",IF(AND(COUNTIF(A:A,A169)>=20,COUNTIF($A$1:A169,A169)<=10),LEFT(A169,1)&"1",LEFT(A169,1)&"2"))


I used A1:A300 and filled with random values. As you can see, VVV is the one with 20 or more entries:
Book1
DE
1AAA13
2BBB8
3CCC13
4DDD8
5EEE17
6FFF12
7GGG13
8HHH10
9III9
10JJJ6
11KKK9
12LLL13
13MMM11
14NNN13
15OOO11
16PPP8
17QQQ13
18RRR13
19SSS12
20TTT8
21UUU12
22VVV21
23WWW13
24XXX12
25YYY9
26ZZZ13
Sheet2
Cell Formulas
RangeFormula
E1:E26E1=COUNTIF($A$1:$A$300,D1)
 
Upvote 0
Solution

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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