Skip to main content

How to add unique id number column for duplicate rows in Excel?

Author: Sun Last Modified: 2024-09-26

Supposing there are some duplicate data in a column, now you want to add unique ID number for these duplicate rows as below screenshot shown, do you have any good ways to add them? Here, I introduce a formula to help you quickly handle this job in Excel.
add unique id number column for duplicates

Adding unique ID number column for duplicate rows with a formula

Adding missing ID number with Kutools for Excelgood idea3


Adding unique ID number column for duplicate rows with a formula

To add unique ID number for duplicate data, you can do as these steps:

1. type 1 into the cell which is adjacent to the first data you want to add ID number.
type 1 into the first cell

2. Then in the cell below it, type this formula =IF(B1=B2,A1,A1+1), press Enter key to get the first result, drag fill handle down until last data showing up.

In the formula, B1, B2 are the first two cells in the duplicate data column, A1 is the first ID cell.
apply a formula and drag it the other cells


Adding missing ID number with Kutools for Excel

If you have a list of ID numbers which including some missing numbers as below screenshot shown, you can apply Kutools for Excel’s Find Missing Sequence Number utility to quickly find and add the missing number.
sample data

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Itegarate with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

After installing Kutools for Excel, please do as below:

1. Select the ID numbers you want to insert missing numbers, click Kutools > Insert > Find Missing Sequence Number.
click Find Missing Sequence Number feature of kutools

2. In the popping dialog, you can choose one option to add or highlight missing numbers as you need.
choose one option to add or highlight missing numbers

3. Click Ok. A dialog pops out to remind you the number of missing data, close it. Then all missing numbers have been added or highlighted in the column or beside the column.

Add missing numbers  Find the missing rows

Add missing numbers	Find the missing rows

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
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

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...


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!