# How to create a URL slug from a title in Excel

Trim the title, remove punctuation with SUBSTITUTE, turn spaces into hyphens and make it lowercase: =LOWER(SUBSTITUTE(…TRIM(A2)…," ","-")).

**Excel:** `=LOWER(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TRIM(A2),":",""),"?",""),",",""),"'",""),"!","")," ","-"))` (Microsoft 365 only)

**Google Sheets:** `=LOWER(REGEXREPLACE(REGEXREPLACE(TRIM(A2),"[^A-Za-z0-9 ]","")," +","-"))`

## Example

Sample data (row 1 is the header):

| A | B |
| --- | --- |
| Title | Slug |
| How to Track Expenses in 2026 |  |
| Q3 Sales: What Changed? |  |
| Ten Tips for Remote Teams |  |
| Ana's Guide to Pivot Tables |  |
| Budget, Forecast, and Plan |  |
| Why Your VLOOKUP Fails! |  |

Formula in B2, filled to B7: `=LOWER(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TRIM(A2),":",""),"?",""),",",""),"'",""),"!","")," ","-"))`

Result: how-to-track-expenses-in-2026; q3-sales-what-changed; ten-tips-for-remote-teams; anas-guide-to-pivot-tables; budget-forecast-and-plan; why-your-vlookup-fails

## How it works

Work from the inside out: TRIM removes stray spaces, each SUBSTITUTE deletes one punctuation mark (`:` `?` `,` `'` `!`), the last SUBSTITUTE turns spaces into hyphens, and LOWER makes it all lowercase.

Google Sheets can do it with patterns: the first REGEXREPLACE deletes anything that isn't a letter, digit or space, the second turns runs of spaces into one hyphen. Excel 365 now has REGEXREPLACE too, and the same formula works there.

## Other ways

- `=LOWER(SUBSTITUTE(TRIM(LET(c,MID(A2,SEQUENCE(LEN(A2)),1),CONCAT(IF(ISNUMBER(FIND(LOWER(c),"abcdefghijklmnopqrstuvwxyz0123456789 ")),c,""))))," ","-"))`: Excel 365: splits the title into characters and keeps only letters, digits and spaces, so any punctuation is removed, not just the marks you listed.

## Common mistakes

- Punctuation between spaces, as in "Sales - Q3", leaves a double space and so a double hyphen. TRIM after removing punctuation, not only before.
- Accented letters (é, ü) pass through. Replace them with SUBSTITUTE if your site needs plain ASCII slugs.
- Two titles can produce the same slug. Check with `=COUNTIF($B$2:$B$7,B2)>1`.

## Questions

**How do I limit a slug to 60 characters without cutting a word?**

Cut at 60, then back to the last hyphen: `=IF(LEN(B2)>60,TEXTBEFORE(LEFT(B2,61),"-",-1),B2)`.

**How do I build the full URL?**

Join the slug to the base address: `="https://example.com/blog/"&B2`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/create-url-slug-from-title
