How to Count Words in Excel — Complete Guide (2026)
Count words in Excel using LEN+SUBSTITUTE: single cells, ranges, specific words, Power Query, VBA. No native WORDCOUNT — here's what works.

Why Excel Has No WORDCOUNT Function
Here's something that surprises a lot of people: Microsoft Excel — a tool with over 500 built-in functions — doesn't have a native word count function. Not one. If you've gone looking for =WORDCOUNT(A1) or something similar, you won't find it. Microsoft Word has it. Google Sheets doesn't either. You're on your own.
That doesn't mean it's impossible. It just means you need to be clever about it. The standard approach combines three functions: LEN, TRIM, and SUBSTITUTE. Together, they count spaces between words — then add one. That's actually how word processors count words too, more or less. You can get surprisingly accurate results once you understand the logic, and once you've got it, the formula is easy to reuse and adapt.
This guide covers everything from counting words in a single cell to scanning entire columns, tracking specific word occurrences, and even building a custom VBA function when the formula approach gets unwieldy. If you spend time working with text data in Excel — cleaning survey responses, auditing content, analyzing product descriptions — these formulas will save you hours. For a broader reference while you work through this, the excel cheat sheet has all the function syntax you'll need in one place.
A quick note on terminology: "word count" in Excel context usually means one of two things. Either you want to count the total number of words in a cell or range, or you want to count how many times a specific word appears in your data. The formulas are different for each case. We'll cover both clearly, so you can jump to whichever one you need right now without reading everything first.
Before diving into formulas, there's one thing you should know: extra spaces break word counting in Excel. If a cell has two spaces between words, or a trailing space after the last word, the count goes wrong — sometimes by a lot if you have hundreds of cells. That's why every formula in this guide uses TRIM as the first step. It strips leading spaces, trailing spaces, and collapses multiple internal spaces down to single spaces. Don't skip it, even if the data looks clean. You'd be surprised how often paste-from-Word or CSV imports leave invisible space characters behind.
The formulas covered here work across all modern Excel versions — Excel 2016, 2019, 2021, and Microsoft 365. The VBA approach requires a macro-enabled file (.xlsm), but the formula-based methods work in any standard .xlsx file. If you're on a Mac, everything here applies except the keyboard shortcut to open VBA (use Fn+Alt+F11 on Mac instead of Alt+F11). Power Query is available on both platforms from Excel 2016 onward.
One more thing before we get into it: understanding the keyboard shortcut to delete row in excel can actually speed up your word-count workflow — when you're cleaning text data and find rows with corrupt or blank content, deleting them quickly keeps your SUMPRODUCT totals accurate. Small workflow habits like that add up when you're processing large datasets.
Throughout this guide, you'll see formulas that look repetitive — TRIM appears multiple times in a single formula, for example. That's intentional. Each TRIM call applies to a specific sub-expression, and skipping one breaks the formula. When you're copying these formulas, copy the full version. It's tempting to simplify, but the redundancy is what makes the formula reliable across different data scenarios.
Count words in a single cell:
=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1
Replace A1 with your cell reference. This formula counts every space after trimming, then adds 1 (because a 3-word string has 2 spaces). Works in all modern Excel versions including Excel 365, 2021, 2019, and 2016.
Word Count Formulas by Use Case
Count the total number of words inside one cell — the most common case.
- Formula: =LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1
- Works In: Excel 2016, 2019, 2021, 365
- Key Functions: LEN, TRIM, SUBSTITUTE
- Handles Edge Cases: Strips extra spaces with TRIM
Add up total words across multiple cells — useful for content audits and text analysis.
- Formula: =SUMPRODUCT(LEN(TRIM(A1:A10))-LEN(SUBSTITUTE(TRIM(A1:A10)," ",""))+1)
- Works In: Excel 2010 and later
- Key Functions: SUMPRODUCT, LEN, TRIM, SUBSTITUTE
- Note: SUMPRODUCT handles array without Ctrl+Shift+Enter
Count how many times a specific word (e.g. "apple") appears in a cell — case-insensitive.
- Formula: =(LEN(A1)-LEN(SUBSTITUTE(LOWER(A1),LOWER("apple"),"")))/LEN("apple")
- Works In: Excel 2010 and later
- Case Handling: LOWER() makes it case-insensitive
- Replace: "apple" with your target word
Count how many cells in a column contain a specific word — not how many times it appears.
- Formula: =COUNTIF(A:A,"*apple*")
- Works In: All Excel versions
- Key Functions: COUNTIF with wildcard
- Note: Counts partial matches too (e.g., "pineapple")

How LEN + SUBSTITUTE Actually Works
The word count formula looks intimidating at first. Break it down and it's actually elegant. LEN(A1) gives you the total character count of a string — every letter, number, space, and punctuation mark. SUBSTITUTE(A1," ","") removes every single space character from that string. So when you subtract, LEN(A1) - LEN(SUBSTITUTE(A1," ","")) tells you exactly how many spaces existed in the string. Add 1 — because a three-word string has two spaces, a four-word string has three — and you have your word count. Simple math hiding behind intimidating syntax.
The TRIM wrapper is non-optional in practice. TRIM(A1) removes leading spaces, trailing spaces, and collapses multiple consecutive internal spaces down to single spaces. Without it, "hello world" (two spaces between the words) counts as three words instead of two, because the double space creates an empty "word" between them. And if the cell has a trailing space, you get an extra phantom word at the end of the count. Always wrap with TRIM. The performance cost is negligible and the accuracy improvement is significant.
One thing that catches people off guard: this formula counts an empty cell as 1. If A1 is blank, LEN(TRIM("")) returns 0, LEN(SUBSTITUTE(""," ","")) returns 0, and 0 - 0 + 1 = 1. Not 0 — 1. You can fix that by wrapping the whole formula: =IF(TRIM(A1)="",0,LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1). That version returns 0 for empty cells, which is what you want in any reporting or auditing scenario.
Another edge case worth knowing about: non-breaking spaces. When you copy text from a web browser, Word document, or CMS export, you sometimes get non-breaking spaces (character code 160) instead of regular spaces (code 32). They look identical. The SUBSTITUTE formula only strips regular spaces — it misses non-breaking ones entirely.
If your word count seems consistently off on pasted content, test with: =LEN(A1)-LEN(SUBSTITUTE(A1,CHAR(160),"")). If that returns anything other than zero, you have hidden characters. Fix: wrap with SUBSTITUTE(A1,CHAR(160)," ") before the main formula. For countifs excel scenarios where you're matching text across conditions, this same normalization matters just as much — COUNTIFS won't match "apple" to "apple" if one has a non-breaking space.
The formula is case-insensitive by default for the total-word-count version — it doesn't care whether a word is capitalized or not. For specific-word counting, though, case matters unless you explicitly handle it. That's why the specific-word formula uses LOWER(A1) and LOWER("apple") — it forces both the source text and target word to lowercase before comparing, making the search case-insensitive. If you want case-sensitive counting (counting "Apple" but not "apple"), drop the LOWER wrappers.
A common question: does this formula count punctuation-attached words correctly? Mostly yes. "Hello, world" counts as 2 — the comma is attached to "Hello" but it's still one space-delimited token. "Don't" counts as 1 word. Hyphenated words like "well-known" count as 1. The formula counts space-delimited tokens, which matches most common definitions of "word" for data purposes. For more precise linguistic word counting (where hyphens split words, contractions split, etc.), you'd need a VBA approach with custom splitting logic.
Word Count Formulas by Task
Formula: =LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1
How it works: Counts the number of spaces in the trimmed string, then adds 1. Each space represents a word boundary.
Example: Cell A1 contains "Excel word count guide" → formula returns 4. Cell A1 contains "hello" (single word) → returns 1. Empty cell → returns 1 (use IF wrapper to get 0 for empty cells).
For empty cell fix: =IF(TRIM(A1)="",0,LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1)
Counting Words Across a Range or Full Column
Counting words in one cell is straightforward. Counting across a range requires a different approach — you can't just drag the single-cell formula and then SUM it, because each cell returns its own count and a simple SUM doesn't handle the array calculation correctly without Ctrl+Shift+Enter. The clean solution is SUMPRODUCT, which processes entire arrays without requiring array entry.
The range formula is: =SUMPRODUCT(LEN(TRIM(A1:A10))-LEN(SUBSTITUTE(TRIM(A1:A10)," ",""))+1). This runs the LEN-SUBSTITUTE logic on every cell in A1:A10 simultaneously, producing an array of individual word counts, then sums them all. For 10 cells, that's 10 word counts combined into one total. It's fast — even for a column of 10,000 rows, it calculates in under a second on modern hardware. You don't need to press Ctrl+Shift+Enter; SUMPRODUCT handles the array internally.
For an entire column — say you want the total word count of every cell in column A — the formula is: =SUMPRODUCT(LEN(TRIM(A:A))-LEN(SUBSTITUTE(TRIM(A:A)," ",""))+1). One warning here: this includes the header row if you have one, and it counts empty cells as 1 each. If column A has 1,000 empty rows below your data, you'll get 1,000 phantom words added to your total. Either specify a precise range (A2:A500) instead of the full column, or add empty-cell protection: =SUMPRODUCT((TRIM(A1:A1000)<>"")*( LEN(TRIM(A1:A1000))-LEN(SUBSTITUTE(TRIM(A1:A1000)," ",""))+1)). The (TRIM(...)<>"") part multiplies by 0 for empty cells, effectively excluding them.
For how to change column width in excel to display your formula results without truncation — especially helpful when your count formulas are in a narrow helper column — double-click the column border to auto-fit. That's a small detail but it matters when you're presenting word count dashboards to stakeholders who need to see all the numbers clearly.
Counting across multiple columns is also common. If your text data spans columns A, B, and C — say three different product description fields — add separate SUMPRODUCT calls: =SUMPRODUCT(LEN(TRIM(A1:A100))-LEN(SUBSTITUTE(TRIM(A1:A100)," ",""))+1) + SUMPRODUCT(LEN(TRIM(B1:B100))-LEN(SUBSTITUTE(TRIM(B1:B100)," ",""))+1). In Excel 365, you can also use VSTACK to combine ranges before running SUMPRODUCT: =SUMPRODUCT(LEN(TRIM(VSTACK(A1:A100,B1:B100)))-LEN(SUBSTITUTE(TRIM(VSTACK(A1:A100,B1:B100))," ",""))+1). The additive approach is more readable and easier to audit; the VSTACK version is cleaner for large multi-column scenarios. Pick whichever matches your comfort level with nested functions.
If you want to see word counts per row (not just a grand total), put the single-cell formula in a helper column. In column B, enter =IF(TRIM(A2)="",0,LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2)," ",""))+1) and drag it down. Now column B shows the word count for each row, and you can use SUM(B2:B1000) for the total.
This approach also lets you sort by word count, filter for rows with too few or too many words, and use conditional formatting to highlight outliers. For content QA work, that per-row visibility is often more useful than a single grand total. You can also sort a column in Excel by the word count column to quickly find your shortest and longest entries — useful for spotting truncated product descriptions or incomplete survey responses.

Word Count Formula Checklist
- ✓Always wrap the cell reference in TRIM() — extra spaces break the count
- ✓Use LOWER() for case-insensitive specific-word counting
- ✓Test your formula on a sample cell before dragging it down the full column
- ✓Use SUMPRODUCT instead of direct SUM for range-based word counts
- ✓Add an IF(TRIM(A1)="",0,...) wrapper if you need empty cells to return 0
- ✓For non-breaking spaces from pasted content, add SUBSTITUTE(A1,CHAR(160)," ") before LEN
- ✓COUNTIF counts cells (not occurrences) — use the LEN/SUBSTITUTE approach for occurrence counting
- ✓Anchor your range with $ signs (e.g. $A$1:$A$100) if the formula will be copied across rows
Practice Excel Formula Skills
Power Query and VBA: When Formulas Aren't Enough
Spreadsheet formulas handle most word count tasks well. But two scenarios push past their limits: processing very large datasets where SUMPRODUCT gets sluggish, and needing a clean reusable function you don't have to reconstruct every time you open a new workbook. Power Query and VBA both solve these problems — just in different ways, with different trade-offs worth knowing before you commit to either.
Power Query word count: Load your data into Power Query via Data → Get Data → From Table/Range. Once you're in the Query Editor, select the column containing your text. Navigate to Add Column → Extract → Word Count. That's it — Power Query adds a new column with the word count for each row automatically. It handles space normalization internally, so you don't need to worry about TRIM or non-breaking spaces.
The result loads back into your worksheet as a regular column you can filter, sort, or feed into further calculations. For anyone investing in advanced Excel skills, Power Query is worth learning regardless of word counting — it handles dozens of text transformations natively that would require complex formulas otherwise.
One limitation: Power Query isn't interactive. If your source data changes, you need to refresh the query (Data → Refresh All) to update the counts. It's a transformation pipeline, not a live formula. That's fine for batch analysis — processing a fixed export from your CMS or CRM — but not ideal if you're entering data in real time and need word counts to update as you type. In those cases, stick with the LEN+SUBSTITUTE formula in a helper column.
VBA WORDCOUNT function: If you want a true custom function that behaves like a native Excel function, VBA is the answer. Open the Visual Basic Editor with Alt+F11. Insert a new Module via Insert → Module. Paste this code:
Function WORDCOUNT(cell As Range) As Long
If Trim(cell.Value) = "" Then
WORDCOUNT = 0
Else
WORDCOUNT = UBound(Split(Trim(cell.Value), " ")) + 1
End If
End Function
Save as .xlsm (macro-enabled workbook). Now =WORDCOUNT(A1) works anywhere in your workbook exactly like a native function. The VBA approach has one technical advantage over the LEN formula: the Split() function splits on any whitespace sequence, not just single spaces. So "hello world" (two spaces) correctly returns 2 instead of 3. For messy text data with inconsistent spacing, VBA is actually more robust than the formula approach — you don't need the TRIM step at all.
The downside: .xlsm files require macro trust settings. In many corporate IT environments, macros are blocked by default — your colleagues open the file and see a security warning, or the functions just return errors. Also, the WORDCOUNT function only works in the workbook containing the VBA module. If you want it everywhere, save the module to your Personal Macro Workbook (PERSONAL.XLSB) — it'll be available in every workbook you open on that machine, but not for other users.
For team use or recurring reports, a shared template with the VBA function pre-loaded is the practical solution. And when you're laying out your word count results table, knowing how to indent in excel helps you create clear visual hierarchy between category labels and their counts — especially useful in summary dashboards where you're presenting results to non-Excel users.
Bottom line on approach selection: for one-off analysis, use the LEN+SUBSTITUTE formula. For large-scale batch processing, use Power Query. For ongoing work where you want a permanent clean function, build the VBA UDF and save it to your Personal Macro Workbook. Each approach fits a different workflow, and knowing all three puts you ahead of most Excel users who default to copy-pasting their word counts from Word.
Troubleshooting: When Word Count Returns Wrong Results
Check for Extra Spaces
Apply TRIM to the Source Cell
Check for Non-Breaking Spaces
Verify Your Delimiter Character
Force Recalculation

Excel Word Count: Quick Reference
Formula vs VBA vs Power Query for Word Counting
- +LEN+SUBSTITUTE: No macros needed, works in any .xlsx file
- +LEN+SUBSTITUTE: Updates live as you type — no refresh required
- +VBA WORDCOUNT: Clean =WORDCOUNT(A1) syntax, handles multi-space strings better
- +VBA WORDCOUNT: Reusable as a custom function across the workbook
- +Power Query: Best performance on large datasets (10,000+ rows)
- +Power Query: Native Word Count option — no formula writing needed
- −LEN+SUBSTITUTE: Verbose formula — hard to read and maintain
- −LEN+SUBSTITUTE: Counts empty cells as 1 without an IF wrapper
- −VBA WORDCOUNT: Requires .xlsm format — macro warnings in corporate environments
- −VBA WORDCOUNT: Doesn't work in workbooks without the module
- −Power Query: Not live — must refresh manually after data changes
- −Power Query: Learning curve for users unfamiliar with Power Query Editor
Excel Questions and Answers
About the Author
Business Consultant & Professional Certification Advisor
Wharton School, University of PennsylvaniaKatherine Lee earned her MBA from the Wharton School at the University of Pennsylvania and holds CPA, PHR, and PMP certifications. With a background spanning corporate finance, human resources, and project management, she has coached professionals preparing for CPA, CMA, PHR/SPHR, PMP, and financial services licensing exams.