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

Office Tab Enable Tabbed Editing and Browsing in Office, and Make Your Work Much Easier...
Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
  • Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
  • More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
  • Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
  • Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
  • Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
  • Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
  • More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.

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


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

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!
officetab bottom
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.
    YT Kong · 4 months ago
    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
  • To post as a guest, your comment is unpublished.
    Cesar · 5 months ago
    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 ?
  • To post as a guest, your comment is unpublished.
    Miskin · 8 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 · 11 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 · 1 years 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!
  • To post as a guest, your comment is unpublished.
    autumn dell · 2 years ago
    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?
  • To post as a guest, your comment is unpublished.
    tejenndra · 2 years ago
    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
    • To post as a guest, your comment is unpublished.
      skyyang · 2 years ago
      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!
  • To post as a guest, your comment is unpublished.
    Brandon · 2 years ago
    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--
    • To post as a guest, your comment is unpublished.
      skyyang · 2 years ago
      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)
  • To post as a guest, your comment is unpublished.
    BUNLEE CHAN · 2 years ago
    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
    • To post as a guest, your comment is unpublished.
      skyyang · 2 years ago
      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!