How to Generate UUID in Excel and Google Sheets
- Excel has no native UUID function — the closest approach uses RAND() and DEC2HEX() to assemble a UUID-shaped string.
- Google Sheets can also use RANDBETWEEN() and BASE() for a similar effect.
- These formulas produce UUID-shaped strings but are NOT cryptographically random and recalculate on every sheet change.
- For real UUID v4 values, generate them outside the spreadsheet and paste as values — this freezes them permanently.
- The Cheetah UUID Generator lets you generate 1 or 10 UUID v4s at once, ready to paste into any cell.
Table of Contents
Spreadsheets are not designed to generate cryptographically random unique IDs, but that does not stop people from needing them. Whether you are building a product catalog, an import file, or a data migration sheet, you need stable unique identifiers. This guide covers the formula approaches in both Excel and Google Sheets, their limitations, and a faster workflow when you need real UUID v4 values in bulk.
Why Excel Has No Native UUID Function
Excel's randomness functions — RAND() and RANDBETWEEN() — use a pseudo-random number generator seeded by the system clock. They recalculate every time the sheet recalculates (any edit, any formula change). That means a "UUID" you generated yesterday will look different tomorrow if you open the file and edit any cell.
This is the fundamental problem: UUID v4 requires exactly one generation event. Once generated, the value must be frozen. Spreadsheet formulas do the opposite — they keep regenerating.
For throwaway IDs (temp row references, mockup data, a one-time import), the formula approach is fine. For real identifiers that must survive edits — use a proper UUID generator and paste as values.
UUID Formula in Excel (No Macro)
Excel does not have native hex output from RAND(), but you can use DEC2HEX from the Analysis ToolPak (enabled by default since Excel 2007).
A simplified UUID-shaped formula (not cryptographically random):
=LOWER(DEC2HEX(RANDBETWEEN(0,4294967295),8)&"-"&DEC2HEX(RANDBETWEEN(0,65535),4)&"-4"&DEC2HEX(RANDBETWEEN(0,4095),3)&"-"&DEC2HEX(RANDBETWEEN(32768,49151),4)&"-"&DEC2HEX(RANDBETWEEN(0,281474976710655),12))
Breakdown:
- First segment: random 8-hex (32-bit)
- Second segment: random 4-hex (16-bit)
- Third segment: hardcoded
4prefix (version), then 3 random hex - Fourth segment:
RANDBETWEEN(32768,49151)produces a value where the first hex is 8, 9, a, or b (the variant bits) - Fifth segment: random 12-hex (48-bit)
Warning: paste-as-values immediately after generation or the IDs will change on every recalculation.
UUID Formula in Google Sheets
Google Sheets does not have DEC2HEX built in, but it has BASE() which converts numbers to any base including 16.
Google Sheets UUID-shaped formula:
=LOWER(BASE(RANDBETWEEN(0,4294967295),16,8)&"-"&BASE(RANDBETWEEN(0,65535),16,4)&"-4"&BASE(RANDBETWEEN(0,4095),16,3)&"-"&BASE(RANDBETWEEN(32768,49151),16,4)&"-"&BASE(RANDBETWEEN(0,281474976710655),16,12))
Same structure as Excel, using BASE() instead of DEC2HEX().
To freeze the values: select the cells with the formula, copy (Ctrl+C), then Paste Special > Paste values only (Ctrl+Shift+V). The cells now hold static strings that will not change.
Sell Custom Apparel — We Handle Printing & Free ShippingUsing VBA to Generate UUIDs in Excel (More Reliable)
If you need proper UUID v4 generation inside Excel and can use macros, a VBA approach is more reliable:
Function GenerateUUID() As String
Dim objTypeLib As Object
Set objTypeLib = CreateObject("Scriptlet.TypeLib")
GenerateUUID = Mid(objTypeLib.Guid, 2, 36)
End Function
This uses the Windows Scriptlet.TypeLib COM object to generate a real GUID (structurally equivalent to UUID). Call it from any cell: =GenerateUUID()
Note: this still recalculates on sheet changes. Use it to generate once, then paste as values. Mac Excel users: this VBA approach does not work on macOS — use the formula method or generate externally.
Fastest Workflow: Generate Outside, Paste In
For most spreadsheet use cases — data imports, product catalogs, migration sheets — the cleanest approach is:
- Decide how many UUIDs you need
- Use the Cheetah UUID Generator to generate them (1 or 10 at a time)
- Copy the output
- Paste into your spreadsheet column
This produces real UUID v4 values with no recalculation risk. The values are frozen the moment you paste.
For bulk needs (100+ IDs), a short terminal loop is faster than clicking 10 times. The generator works well for seeding a handful of rows or generating IDs for a specific set of records.
When Formula UUIDs Are Good Enough
The formula approach is fine when:
- You need throwaway IDs for mockup or prototype data
- You are preparing a one-time import file and will paste-as-values before using it
- The IDs do not need to be cryptographically random — just unique-enough for a spreadsheet
- You have no access to a terminal or external tool
The formula approach is not acceptable when:
- The IDs will be used as database primary keys in production
- The IDs must comply with RFC 4122 (e.g., for API calls, audit logs, or external system integrations)
- The sheet will be shared and others might accidentally trigger recalculation
In those cases, generate real UUIDs externally and paste as values.
Need UUIDs for a Spreadsheet Import?
Generate 1 or 10 real UUID v4 values instantly with the Cheetah UUID Generator — no formulas, no recalculation risk. Copy and paste directly into Excel or Google Sheets.
Open Free UUID GeneratorFrequently Asked Questions
Does Excel have a built-in UUID or GUID function?
No. Excel has no native UUID function. You can approximate one using DEC2HEX and RANDBETWEEN, or use VBA with the Scriptlet.TypeLib COM object on Windows.
How do I stop my UUID formula from changing every time I edit the sheet?
Select the cells, copy, then Paste Special > Values only (or Ctrl+Shift+V in Google Sheets). This replaces the formula with the static string it produced.
Are Excel/Google Sheets UUID formulas cryptographically random?
No. RAND() and RANDBETWEEN() are pseudo-random and not suitable for security-sensitive IDs. They are fine for data organization but not for tokens, API keys, or security identifiers.
Can I generate UUIDs in Google Sheets with a script?
Yes. In Google Sheets, go to Extensions > Apps Script and use Utilities.getUuid() — this returns a real UUID v4 string. You can loop it to fill a column.
What is the fastest way to get 10 UUIDs into a spreadsheet?
Use the Cheetah UUID Generator — click Generate 10, copy the output, paste into your spreadsheet. Ten real UUID v4 values in under 10 seconds.

