Text
Remove Duplicate Words
Remove duplicate words from a text string, keeping only the first occurrence of each word. Useful for cleaning tags, keywords, or messy text data.
Excel Formula
=TEXTJOIN(" ",TRUE,IF(MATCH(TEXTSPLIT(A2," "),TEXTSPLIT(A2," "),0)=SEQUENCE(LEN(A2)-LEN(SUBSTITUTE(A2," ",""))+1),TEXTSPLIT(A2," "),""))Google Sheets Version
=TEXTJOIN(" ",TRUE,UNIQUE(SPLIT(A2," ")))Step-by-Step Explanation
1
TEXTSPLIT (Excel) or SPLIT (Sheets) breaks text into individual words
2
UNIQUE removes duplicate entries
3
TEXTJOIN reassembles with spaces
4
TRUE parameter skips empty strings
5
Google Sheets version is significantly simpler
Example
| Original (A) | Cleaned (B) |
|---|---|
| apple banana apple cherry | apple banana cherry |
| red blue red green blue | red blue green |
Result: Sheets: =TEXTJOIN(" ",TRUE,UNIQUE(SPLIT(A2," "))) → apple banana cherry
Common Variations
Case-insensitive
=TEXTJOIN(" ",TRUE,UNIQUE(SPLIT(LOWER(A2)," ")))Treats Apple and apple as same
Comma-separated
=TEXTJOIN(", ",TRUE,UNIQUE(SPLIT(A2,", ")))For comma-delimited lists
Need a Custom Version?
Use our AI generator to create a formula tailored to your specific data and requirements.
Try It with AI →