FormulaCraft

How to count words in a cell in Excel and Google Sheets

Excel & Google Sheets
=LEN(A2)-LEN(SUBSTITUTE(A2," ",""))+1

Verified example

Computed by a real spreadsheet engine on the sample data below.

Text
Hello world
This is a test.
Multiple spaces here
Line break

=LEN(A2)-LEN(SUBSTITUTE(A2," ",""))+12

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Select the cell where you want the word count to appear.
  2. 2Enter the formula provided for Excel or Google Sheets.
  3. 3Press Enter to see the word count.

Tips

Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.

Frequently asked

What if my text has multiple spaces between words?

Adjust the formula to account for multiple spaces by using TRIM and SUBSTITUTE functions to normalize spacing.

Can this formula handle punctuation correctly?

The formula counts punctuation as part of the word. To exclude punctuation, additional string manipulation functions would be needed.

Does this work for cells with line breaks?

No, line breaks are not considered as word separators in this formula. You may need to modify the formula to include CHAR(10) for line breaks.

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: