How to Count Word Frequency in Excel With TEXTSPLIT
By ExcelReady TeamUpdated 7 min read
The short answer
To count word frequency in Excel, join the text with TEXTJOIN and split it into one word per row with TEXTSPLIT, using spaces and punctuation as delimiters. List each word once with UNIQUE, count each one with COUNTIF on the split list, and sort the result with SORTBY. TEXTSPLIT needs Microsoft 365 or Excel 2024.
Key takeaways
- TEXTJOIN merges many cells into one text; TEXTSPLIT with a row delimiter turns it into one word per row.
- Pass several delimiters in braces, {" ",",","."}, and TRUE to drop the empty pieces.
- UNIQUE lists each word once, and COUNTIF on the spilled word list counts it.
- COUNTIF needs a range, so spill the words into cells first instead of nesting TEXTSPLIT inside COUNTIF.
- Wrap the text in LOWER so Late and late are listed as one word in a tidy case.
On this page+
- The example data
- Step 1: split the text into one word per row with TEXTSPLIT
- Step 2: list each word once with UNIQUE
- Step 3: count each word with COUNTIF
- Step 4: sort words by frequency
- Remove common words like "the" and "and"
- Count one word without a frequency table
- Common word frequency problems
- Practise it
To count word frequency in Excel, you turn the text into a list with one word per row, then count how often each word appears. In Microsoft 365, three functions do it: TEXTSPLIT splits the text into words, UNIQUE lists each word once, and COUNTIF counts each one. This guide is for anyone analysing survey comments, customer reviews, support tickets or job descriptions who wants to see which words come up most.
The example data#
All examples use four short customer comments in A2:A5:
| A | |
|---|---|
| 1 | Comment |
| 2 | Delivery was late again. |
| 3 | Great service, but the delivery was late. |
| 4 | Late delivery and no reply. |
| 5 | Fast delivery, great price. |
The goal is a table of each word and its count, with "delivery" (4) and "late" (3) at the top.
TEXTSPLIT needs Microsoft 365 or Excel 2024. UNIQUE and SORTBY need Excel 2021 or later. For older versions, see the last section.
Step 1: split the text into one word per row with TEXTSPLIT#
TEXTJOIN joins all the comments into one long text, and TEXTSPLIT cuts it into words. In C2:
=TEXTSPLIT(TEXTJOIN(" ",TRUE,LOWER(A2:A5)),,{" ",",","."},TRUE)Here is what each part does:
LOWER(A2:A5)makes every letter lower case, so "Late" and "late" look the same.TEXTJOIN(" ",TRUE, ...)joins the four comments with a space between them. TRUE skips empty cells.- In TEXTSPLIT, the column delimiter is left empty (
,,), so the text is split into rows, not columns. {" ",",","."}is a list of delimiters: space, comma and full stop. The braces let you pass several at once.- The last TRUE drops empty pieces, such as the gap between a comma and the space after it.
The formula spills 20 words down column C, one per row. The guide to the TEXTSPLIT function and the TEXTSPLIT function reference explain every argument.
Add any other punctuation your text uses, such as "!", "?", ";" or ":", to the list in braces.
Step 2: list each word once with UNIQUE#
UNIQUE returns each distinct value from a list once. In E2:
=UNIQUE(C2#)C2# is a spill reference: it means "the whole list that spilled from C2", however long it is. The result is 13 distinct words, in the order they first appear: delivery, was, late, again, great, service and so on. The UNIQUE function guide and the article on counting unique values cover UNIQUE in more depth.
UNIQUE is not case-sensitive, so it would treat "Late" and "late" as one word even without LOWER. LOWER just makes the list look consistent.
Step 3: count each word with COUNTIF#
COUNTIF counts how many cells in a range match a value. Point it at the spilled word list, with the unique words as the criteria. In F2:
=COUNTIF(C2#,E2#)Because E2# holds 13 words, the formula spills 13 counts, one for each word:
| Word | Count |
|---|---|
| delivery | 4 |
| was | 2 |
| late | 3 |
| again | 1 |
| great | 2 |
| service | 1 |
The other seven words appear once each. The counts add up to 20, the number of words in C2#, which is a quick check that nothing was lost. The COUNTIF function guide and the article on counting by category show the same pattern for other lists.
COUNTIF needs a range as its first argument. That is why the words are spilled into column C first. A formula like =COUNTIF(TEXTSPLIT(...),"late") returns an error, because TEXTSPLIT's result inside a formula is an array, not a range.
Step 4: sort words by frequency#
SORTBY sorts one list by the values in another. To put the most common words first, in H2:
=SORTBY(E2#,F2#,-1)and in I2:
=SORT(F2#,,-1)The -1 means largest first. The top of the list is now delivery (4), late (3), was (2) and great (2). Words with the same count keep their original order.
Remove common words like "the" and "and"#
Short common words such as "the", "and" and "was" are called stop words. They usually top a frequency list but say little. Type the words you want to ignore in K2:K10, then filter them out of the word list before counting. In D2:
=FILTER(C2#,COUNTIF($K$2:$K$10,C2#)=0)COUNTIF checks each word against the stop list. A count of 0 means the word is not a stop word, so FILTER keeps it. Then use D2# instead of C2# in the UNIQUE and COUNTIF formulas.
Count one word without a frequency table#
To count a single word, you don't need the whole table. In Microsoft 365, compare the split words with the word you want and add the TRUE results:
=SUM(--(TEXTSPLIT(TEXTJOIN(" ",TRUE,LOWER(A2:A5)),,{" ",",","."},TRUE)="delivery"))The result is 4. The comparison returns TRUE or FALSE for each word, and -- turns them into 1 and 0 so SUM can add them.
In older versions, a classic text trick counts how many times a word appears in a cell:
=(LEN(A2)-LEN(SUBSTITUTE(LOWER(A2),"late","")))/LEN("late")SUBSTITUTE removes every "late", and the drop in length divided by the word's length is the count. The catch: it also counts "late" inside "latest" or "chocolate". The guide to counting characters and words explains the trick in detail.
Common word frequency problems#
Messy text gives messy counts. Check these:
- Extra spaces or line breaks. Double spaces are handled by the TRUE at the end of TEXTSPLIT, but line breaks are not. Add
CHAR(10)to the delimiter list, or clean the text with CLEAN and TRIM first. - Missing punctuation in the delimiter list. "late!" and "late" are counted as different words.
- Too much text. TEXTJOIN's result can't be longer than 32,767 characters. For long text, split each cell separately, or work on a sample.
- Old Excel. Without TEXTSPLIT, use Data > Text to Columns to split the words, stack them into one column, then count them with COUNTIF or a PivotTable.
Practise it#
Word frequency combines three everyday skills: cleaning text, listing unique values and counting matches. Practise cleaning messy text in a live spreadsheet, practise the UNIQUE function, and practise COUNTIF. ExcelReady checks each formula as you type. Start with the "delivery" count in the exercise on this page.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
How many times does the word delivery appear in the comments? Click C2 and type =SUM(--(TEXTSPLIT(TEXTJOIN(" ",TRUE,LOWER(A2:A5)),,{" ",",","."},TRUE)="delivery")), then press Enter.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Comment | Count of delivery | ||
| 2 | Delivery was late again. | |||
| 3 | Great service, but the delivery was late. | |||
| 4 | Late delivery and no reply. | |||
| 5 | Fast delivery, great price. | |||
| 6 | ||||
| 7 | ||||
| 8 |
Tip: TEXTJOIN joins the four comments, TEXTSPLIT splits them into words at spaces, commas and full stops, and the comparison with "delivery" gives TRUE or FALSE. -- turns those into 1s and 0s for SUM.
Practise this in a lesson
Frequently asked questions
How do I count how many times each word appears in Excel?
Split the text into one word per row with =TEXTSPLIT(TEXTJOIN(" ",TRUE,A2:A5),," "), list each word once with UNIQUE, then count each word with COUNTIF on the spilled word list. Sort the counts with SORTBY.
How do I count a specific word in a cell in Excel?
In Microsoft 365, use =SUM(--(TEXTSPLIT(LOWER(A2)," ")="late")). In older versions, =(LEN(A2)-LEN(SUBSTITUTE(LOWER(A2),"late","")))/LEN("late") works, but it also counts the word inside longer words such as latest.
Why does COUNTIF give an error with TEXTSPLIT?
COUNTIF only accepts a range of cells as its first argument, not an array calculated inside the formula. Spill the TEXTSPLIT result into cells first and point COUNTIF at it with the # spill reference.
Can I count word frequency without TEXTSPLIT?
In older Excel, split the text with Data > Text to Columns, copy the words into one column, then use a PivotTable or COUNTIF on that column. It works, but it doesn't update when the text changes.