Skip to main content

How to assign serial number to duplicate or unique values in Excel?

If you have a list of values which contains some duplicates, is it possible for us to assign sequential number to the duplicate or unique values? It means giving a sequential order for the duplicate values or unique values as following screenshot shown. This article, I will talk about some simple formulas to help you solving this task in Excel.

doc assign duplicates unique 1

Assign serial number to duplicate values with Formula

Assign serial number to unique value with Formula


arrow blue right bubble Assign serial number to duplicate values with Formula

To order the duplicate values, please apply the following formula:

Enter this formula: =COUNTIF($A$2:A2,A2) into a blank cell beside your data, and then drag the fill handle down to the cells which you want to apply this formula, and the cell values have been assigned based on the duplicate values, see screenshot:

doc assign duplicates unique 2


arrow blue right bubble Assign serial number to unique value with Formula

To assign serial number to unique value, the below formula may do you a favor:

Enter this formula: =IF(COUNTIF(A$2:A2,A2)=1,MAX(B$1:B1)+1,VLOOKUP(A2,A$1:B1,2,0)) into a blank cell beside your data, and then drag the fill handle down to the cells that you want to apply this formula, and the unique values have been ordered as following screenshot shown:

doc assign duplicates unique 3

Notes:

1. In the above formula, A2 is the cell contain the value you want to assign, B1 is the above cell where your formula located.

2. These formulas also can applied to the values in sorted list, and you will get the following result as you want:

doc assign duplicates unique 4

Best Office Productivity Tools

Supports Office/Excel 2007-2021 and 365  |  Available in 44 Languages  |  Easy to Uninstall Completely

Popular Features: Find/Highlight/Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns     Move Columns   |   Unhide Columns   |   Compare Columns to Select Same & Different Cells ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need Is Just A Click Away...

Supercharge Your Excel Skills: Experience Efficiency Like Never Before with Kutools for Excel  (Full-Featured 30-Day Free Trial)

kte tab 201905

60-Day Unconditional Money-Back GuaranteeRead More... Free Download... Purchase... 

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day! (Full-Featured 30-Day Free Trial)
60-Day Unconditional Money-Back GuaranteeRead More... Free Download... Purchase... 
 
Comments (23)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Solución bastante sencilla y funciona bien.
This comment was minimized by the moderator on the site
Getting NA result for more than 200 cells
This comment was minimized by the moderator on the site
Thanks for the formula, my only problem is that I want the generated 'unique identifiers' to be locked/linked to the 'values' but whenever I sort the table, the identifiers always remain in the same spot. Is there a way so that they stay linked to one another?

For example, I am using this code to assign serial numbers to customers, these need to be permanently assigned to one another as they do not change. However, when I sort the table by date, customers or anything at all that re-arranges the data. The serial numbers all get mixed up.
This comment was minimized by the moderator on the site
How to Convert a Cell Containing


A1 = Apple, Orange, Banana, Grapes

to

A1 = 1. Apple, 2. Orange, 3. Banana, 4. Grapes
This comment was minimized by the moderator on the site
Hello there,

If i want the formula to have alphabet infront is it possible?

DO123455 =A1
DO123455 =A1
DO223344 = A2
DO223344 = A2
DO567890 = A3

Appreciate if you can assist on my problem.

Thank you

YT Kong
This comment was minimized by the moderator on the site
Hi, i want some help, i need my data right this:

A 1
A 2
A 3
B 1
B 2
C 1
D 1
C 1
C 2
B 1
E 1
E 2
A 1
I need taht when it finds a new value starts since 1, every time. Is it posible ?
This comment was minimized by the moderator on the site
=COUNTIF(G$2:G2,G2)
=COUNTIF(G$2:G3,G3)
This comment was minimized by the moderator on the site
I want serial number start from 1 when it encounter new series
Like
AA - 1
BB - 1
AA - 2
CC -1
DD -1
AA - 3
BB - 2

Is this possible?
This comment was minimized by the moderator on the site
possible, simple guys=IF(COUNTIF(A$2:A7;A7)>=1;COUNTIF(A$2:A7;A7);VLOOKUP(A7;A$2:W6;23;0)+1)
This comment was minimized by the moderator on the site
=COUNTIF(G$2:G2,G2)
=COUNTIF(G$2:G3,G3)
This comment was minimized by the moderator on the site
Is it possible to do this with power query, and not with the vlookup formula?
This comment was minimized by the moderator on the site
Is it possible to assign such serial numbers within the same cell? I have a sheet that does this using a macro, but I cannot access the macro (password protected) to see how they did it.
Disclaimer: I have permission to access the macros, but it is an old sheet and the passwords are lost.
This comment was minimized by the moderator on the site
hai pls help

i have a series of data and i want this type of results
item product sequence number
a powder 1
a juice 2
b preprocess 2
b process 3
b jucie 1
c powder 1
c juice 2
c preprocess 3
c procss 4


want sequence number based on item and product column
This comment was minimized by the moderator on the site
CA-01.1
CA-01.2
CA-01.3
CA-01.4
CA-01.5
CA-01.6
CA-01.7
CA-02.1
CA-02.2
CA-02.3
CA-02.4
CA-02.5
CA-02.6
CA-02.7
CA-02.8
CA-02.9
CA-02.10
CA-02.11
CA-03
CA-03
CA-03
CA-03
CA-03


I need to continue this auto-fill in sequential order for hundreds of CA-##s, please help.


Thanks!
This comment was minimized by the moderator on the site
I have a series of data and I want to assign every data which repeat more than 6 times in a row with the value zero. How can I do it? plz, help me out?
This comment was minimized by the moderator on the site
=if(countif(unique value)>6,0,actual value)
This comment was minimized by the moderator on the site
i have this data in sheet1, i work in this sheet on daily basis.

after that i make New Sheet on State Wise Name Like DL, UK, JK, MH etc.
is there any formula who automatic record State entry in State sheet, Like All DL related entry automatic record in DL Sheet.
ID I2 I3 I4 STATE
101 a j 99 DL
102 b k 55 UK
103 c l 44 JK
104 d m 22 MH
105 e n 33 DL
106 f o 77 WB
107 g p 25 DL
This comment was minimized by the moderator on the site
Hello, tejenndra,
As your problem, may be the Kutools for Excel's Split Data feature can help you. With the Split Data utility , you can quickly split the data from one sheet to others based on column or row.

Take your data for example, after applying the Split Data feature, you will get the following result:

Please let me know if this can help you! Thank you!
This comment was minimized by the moderator on the site
I have a column with the same #s listed, but when the formula reaches a duplicate number, it gives an #N/A.


--Order-- --Serial--
--1132595277-- --1--
--1132595201-- --2--
--1132595277-- --#N/A--
This comment was minimized by the moderator on the site
Hi, Brandon,
I have tested your example in my workbook, but the formulas work well, can you attach your file or try the formulas again?
Thanks! (a)
This comment was minimized by the moderator on the site
in case there are 2 values, i have apply with below formula, but assign unique is going to be error for duplicate value1 & value2, could you pls help advise how to deal with this?

=IF(COUNTIFS($A$2:A7,A7,$B$2:B7,B7)=1,MAX($C$1:C6)+1,VLOOKUP(A7&B7,$A$1:C7,2,0))

Ex:

Value1 Value 2 Assign unique
AA 11 1
BB 22 2
AA 11 #N/A
This comment was minimized by the moderator on the site
Hello,

If you have multiple columns need to use, first, you can combine the columns into a new helper column by using this formula:=A2&" "&B2,and then apply above
formula based on the helper column. you will get the result as you need.


Here is an image example, hope it can help you, thank you!
This comment was minimized by the moderator on the site
Hi, I need your support,

I have a series of different products sold in different districts. My dataset has duplicate products in all districts and I don't want to remove those duplicate. I want to count unique product in different district in different years. I added one column in EXCEL and I want to put a formula that will rename the product sold in new district for first time to be "NEW" and the continuation of sales of the same product to be renamed "CONTINUING". Which formula I ma supposed to apply in Excel? This is a sample dataset I have; I want the syntax formula in Column "Sales Status"

District: Product Concat (District+Product Sale Status

Iringa A Iringa- A New

Iringa A Iringa- A Continuing

Iringa B Iringa- B New

Morogoro A Morogoro- A New

Morogoro A Morogoro- A Continuing
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations