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

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or 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  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
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

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


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!
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
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations