Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

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

Excel Productivity Tools

Office Tab: Bring powerful tabs to Office (include Excel), just like Chrome, Safari, Firefox and Internet Explorer. Save you half the time, and reduce thousands of mouse clicks for you. 30-day Unlimited Free Trial

Kutools for Excel: Save 70% of your time and solve 80% Excel problems for you. 300+ advanced features designed for 1500+ work scenario, make Excel much easy and increase productivity immediately. 60-day Unlimited Free Trial


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


Excel Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 70%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 80% Excel problems.

  • Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  • Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  • Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  • No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  • Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  • 60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  • Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Miskin · 1 months ago
    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?
  • To post as a guest, your comment is unpublished.
    Eric · 4 months ago
    Is it possible to do this with power query, and not with the vlookup formula?
  • To post as a guest, your comment is unpublished.
    Alex · 11 months ago
    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.
  • To post as a guest, your comment is unpublished.
    MIDHIN C R · 1 years ago
    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
  • To post as a guest, your comment is unpublished.
    JohnHambright · 1 years ago
    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!