How to Create UNIQUE ID in Excel

This guide treats “create unique id in excel” the way busy spreadsheet users actually want it: answer first, then the reasoning. It is written for Excel but calls out every place Google Sheets differs, and the platform toggle at the top switches all shortcuts between Windows and Mac so nothing here assumes the keyboard you are not on.

Exact answer

In Excel: build one with a formula such as ="ID-"&TEXT(ROW()-1,"0000"), which turns row 2 into ID-0001, row 3 into ID-0002, and so on — this is not the same job as the UNIQUE() function, which removes duplicates from an existing list rather than creating new identifiers.

On this page7
Annotated stepsExcel
1

Decide whether the ID needs to survive rows being deleted or reordered later — if yes, avoid a plain ROW()-based formula.

2

For a simple sequential ID, enter ="ID-"&TEXT(ROW()-1,"0000") in the first data row and fill down.

3

For an ID that should not shift when rows are removed, use ="ID-"&TEXT(COUNTA($A$2:A2),"0000") and fill down.

4

Once IDs are assigned and need to stay fixed permanently, copy the column and Paste Values so future edits cannot silently renumber it.

="ID-"&TEXT(ROW()-1,"0000")
Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

What this does

Creating a unique ID means generating a new value that has never existed before, one per row, guaranteed not to repeat. That is a different problem from UNIQUE(), which takes a list that already has duplicates and returns only the distinct values from it — UNIQUE() cannot invent an ID column from nothing. Row-based IDs (using ROW()) are the simplest option when rows never get reordered or deleted; concatenating several existing fields (date + name + a running count) is more robust for data that gets resorted. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “create unique id in excel”. Start on a copy or a tiny sample, keep the affected cells visible, and compare the result with the tool above before you touch the real workbook. When a formula is involved, keep the inputs labelled beside it, reference cells instead of typing values, and apply number formatting only after the result checks out. The point is a data step that keeps your analysis trustworthy, but the practical win is that someone else can open the file and understand what happened without asking you.

A worked example

A new orders sheet has customer names starting in A2 with no ID column yet. In B2, ="ORD-"&TEXT(ROW()-1,"0000") returns ORD-0001; filled down to row 51, B51 returns ORD-0050. If rows can later be deleted, a formula tied to ROW() will renumber and break the link to any ID already referenced elsewhere — use ="ORD-"&TEXT(COUNTA($A$2:A2),"0000") instead, which counts filled rows above and keeps assigning the next number even after a row above it is removed, or paste the column as values (Copy ▸ Paste Values) once IDs should be frozen rather than recalculated. Order systems, form responses and merged data sets all need a stable key eventually, and building one wrong — with a formula that quietly renumbers itself — causes ID collisions or broken lookups much later than when the mistake was made. A practical tip before you scale it up: build it once on a small block of test data, confirm the number against the tool on this page, and only then point it at your real sheet. That one habit catches almost every mistake while it is still cheap to fix, long before a wrong figure reaches a report or a colleague.

In Google Sheets

Google Sheets handles this almost identically to Excel. The formula syntax above is the same, and the menu lives under a slightly different label rather than a ribbon tab. Use the platform toggle at the top of the page to switch every keyboard shortcut between Windows and Mac, and expect at most cosmetic differences in naming. Keep this page bookmarked for the next time the same question comes up. Better still, repeat the steps once in your own workbook — doing it yourself is what turns a copied answer into something you remember. Treat “create unique id in excel” as a small building block rather than a chore. Once the inputs sit in their own cells and the formula reads from them, the same setup answers a dozen related questions with a tweak, and Excel keeps every dependent figure current as the data changes. The tool above is there so you can rehearse and verify before committing anything to a real workbook; the steps and worked example are there so the logic sticks. Get it right once and it stops costing you time — it starts saving it, every time the question comes back around.

Common mistakes

  • Reaching for the UNIQUE() function expecting it to generate IDs — it only filters an existing list down to distinct values, it does not create anything new.
  • Leaving the ID formula live (not pasted as values) on a sheet where rows get deleted, which silently renumbers every ID below the deletion.
  • Skipping the TEXT() padding, so IDs sort as text out of numeric order (ID-1, ID-10, ID-2...) instead of ID-0001, ID-0002, ID-0010.
  • Using RAND() or RANDBETWEEN() for an ID expecting it to be permanent — those functions recalculate on every edit and change the value again.

Frequently asked questions

How do I create a unique ID in Excel?

Use a formula like ="ID-"&TEXT(ROW()-1,"0000") for a sequential ID, or concatenate several fields (date, initials, a running count) for an ID that stays unique even if rows are resorted.

Can UNIQUE() generate IDs for me?

No. UNIQUE() only returns the distinct values already present in a range — it removes duplicates, it does not invent new identifiers.

Does the same ID formula work in Google Sheets?

Yes — ROW(), TEXT() and COUNTA() all work the same way in Google Sheets, so ="ID-"&TEXT(ROW()-1,"0000") produces identical results there. Sheets' UNIQUE() has the same de-duplication-only behavior as Excel's.

Other ways people ask this

People reach this page typing “create a unique id in excel”, “excel create unique id” and “how to create a unique id in excel”, among other phrasings; whichever wording you used, the fix above is the one you want.

Why do people search for this in so many different ways?

Because the same task has many names. “create a unique id in excel”, “excel create unique id”, “how to create a unique id in excel” all point at the one operation explained on this page, which is why they all lead here.