Count words and characters in Google Sheets: LEN function

Though word and character count in Google Sheets are used in rare cases, it is still the functionality that some of us expect to see right in the menu. But unlike Google Docs, for Google Sheets, it is the LEN function that does that.

Even though there are many different ways to count characters in spreadsheets, today's blog post will cover the LEN function as its main purpose in tables is to – well, count :) However, it is hardly ever used on its own. Below you will learn how to use Google Sheets LEN correctly and find the most wanted formulas to compute characters in spreadsheets.

Google Sheets LEN function – usage and syntax

The main and the only purpose of the LEN function in Google Sheets is getting the string length. It is so simple that it even requires only 1 argument:

  • it can take either the text itself in double-quotes:
  • or a reference to a cell with the text of interest:

Let's see if there are any peculiarities in using the function in spreadsheets.

Character count in Google Sheets

I'll start with the simplest operation: do a character count in Google Sheets the most common way – by referencing a cell with the text using the LEN function.

I enter the formula to B2 and copy it down the entire column to count characters in each row:


Character count in Google Sheets.

Note. The LEN function computes all characters: letters, numbers, spaces, punctuation marks, etc.

You may think that in a similar manner you could do a character count for the entire range of cells, like this: LEN(A2:A6). But, as bizarre as it is, it doesn't simply work this way.

To total characters in several cells, you should wrap your LEN in SUMPRODUCT – the function that tallies up the numbers from entered ranges. In my case, the range is returned by the LEN function:


Tally character count in Google Sheets with the help of SUMPRODUCT.

Of course, you could incorporate the SUM function instead. But SUM in Google Sheets doesn't process arrays from other functions. To make it work, you will have to add another function – ArrayFormula:


Use ArrayFormula along with the SUM and LEN functions to count characters in Google Sheets.

How to count characters without spaces in Google Sheets

As I noted above, Google Sheets LEN function counts each and every character it sees including spaces.

But what if there are extra spaces added by mistake and you don't want to consider them for the result?

For cases like this, there's the TRIM function in Google Sheets. It checks the text for leading, trailing, and repeated spaces in-between. When TRIM is paired with LEN, the latter doesn't count all those odd spaces.

Here's an example. I added spaces in different positions in column A. As you can see, when on its own, Google Sheets LEN counts them all:


Count all characters including all extra spaces.

But as soon as you integrate TRIM, all extra spaces are ignored:


Count characters without extra spaces in Google Sheets.

You can go further and make your formula disregard even those single spaces between words. The SUBSTITUTE function will assist. Though its main purpose is to replace one character with another, there's a trick to make it reduce spaces completely:

=SUBSTITUTE(text_to_search, search_for, replace_with, [occurrence_number])
  • text_to_search is the range you work with: column A, or A2 to be exact.
  • search_for should be a space character in double-quotes: " "
  • replace_with should contain empty double-quotes. If you're going to ignore spaces, you need to replace them with literally nothing (empty string): ""
  • occurence_number is normally used to specify the instance to replace. But since I'm describing how to count characters without all spaces, I suggest you omit this argument as it is optional.

Now try and assemble all these into Google Sheets LEN and you'll see that no space is taken into account:

=LEN(SUBSTITUTE(A2, " ", ""))

Count characters without all spaces in Google Sheets.

Google Sheets: count specific characters

The same tandem of Google Sheets LEN and SUBSTITUTE is used whenever you need to count specific characters, letters, or numbers.

In my examples, I'm going to find out the number of occurrences for the letter 's'. And this time, I'll start with a ready-made formula:

=LEN(A2)-LEN(SUBSTITUTE(A2, "s", ""))

Let's break it down to pieces to understand how it works:

  1. SUBSTITUTE(A2, "s", "") looks for the letter 's' in A2 and replaces all occurrences with "nothing", or empty string ("").
  2. LEN(SUBSTITUTE(A2, "s", "") works out the number of all characters but 's' in A2.
  3. LEN(A2) counts all characters in A2.
  4. Finally, you subtract one from the other.

The result difference shows how many 's' there are in the cell:

Google Sheets: count specific characters.

Note. You may wonder why B1 says there's only 1 's' in A2 while you can see 3?

The thing is, the SUBSTITUTE function is case-sensitive. I asked it to take all instances of 's' in lowercase and so it did.

To make it ignore text case and process letters in both lower and upper cases, you will have to call one more Google Sheets function for help: LOWER.

It is as simple as Google Sheets LEN and TRIM because all it requires is the text:


And all it does is turn the entire text string into lower case. This trick is exactly what you need to make Google Sheets count specific characters no matter their text case:


Google Sheets: count specific characters of all text cases.

Tip. And as before, to count the total of specific characters in the range, wrap your LEN in SUMPRODUCT:


Count the number of all occurrences of a specific character in a range.

Count words in Google Sheets

When there are multiple words in cells, chances are you will need to have their number instead of the Google Sheets string length.

And though there are multiple ways of doing so, today I will mention how Google Sheets LEN does the job.

Remember the formula I used to count specific characters in Google Sheets? In fact, it will come in handy here as well. Because I'm not going to literally count words. Instead, I will count the number of spaces between the words and then simply add 1. Have a look:

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

  1. LEN(A2) counts the number of all chars in the cell.
  2. LEN(SUBSTITUTE((A2)," ","")) removes all spaces from the text string and counts remaining chars.
  3. Then you subtract one from the other, and the difference you get is the number of spaces in the cell.
  4. Since words always outnumber spaces in a sentence by one, you add 1 at the end.

How to count words in Google Sheets.

Google Sheets: count specific words

Finally, I'd like to share a Google Sheets formula that you can use to count specific words.

Here I have The Mock Turtle's Song from Alice's Adventures in Wonderland:

Repeated words in spreadsheets.

I want to know how many times the word 'will' appears in each row. I believe you won't be surprised if I tell you that the formula I need consists of the same functions as before: Google Sheets LEN, SUBSTITUTE, and LOWER:

=(LEN(A2)-LEN(SUBSTITUTE(LOWER(A2), "will", "")))/LEN("will")

The formula may look scary but I can assure you that it's easy to comprehend, so bear with me :)

  1. Since the text case doesn't matter to me, I use LOWER(A2) to turn everything to lowercase.
  2. Then goes SUBSTITUTE(LOWER(A2), "will",""))) – it gets rid of all occurrences of 'will' by replacing them with empty strings ("").
  3. After that, I subtract the number of characters without the word 'will' from the total string length. The number I get counts all characters in all occurrences of 'will' in each row.

    Thus, if 'will' appears once, the number is 4 as there are 4 letters in the word. If it appears twice, the number is 8, and so on.

  4. Finally, I divide this number by the length of the single word 'will'.

Google Sheets: how to count specific words.

Tip. And again, if you'd rather get the total number of all appearances of the word 'will', just enclose the entire formula by SUMPRODUCT:

=SUMPRODUCT((LEN(A2:A7)-LEN(SUBSTITUTE(LOWER(A2:A7), "will", "")))/LEN("will"))

Count how many times a certain word appears in the range.

As you can see, all these cases of character-count are solved by the same patterns of the same functions for Google Sheets: LEN, SUBSTITUTE, LOWER, and SUMPRODUCT.

If some formulas still confuse you, or if you're not sure how to apply everything to your particular task, don't be shy and ask away in the comments section below!

You may also be interested in

25 comments to "Count words and characters in Google Sheets: LEN function"

  1. Chris says:

    Hello. I parsed text in a text document into multiple rows of 1 word tags. I then converted that to a CSV file, and uploaded to Google Sheets. I now want to take that google sheet - a single row of 1 word tags, plus some other rows with 3 or 4 miscl. words that will prove to be not significant in number, and count the number of cells in a column that have the value of "APPLES", as well as the count for how many with the value of "ORANGES". Is there an easier way to do this, then LEN? Whatever the simplest way to do it is, can you show me an example? Thanks.

    • Hello Chris,

      to count the number of cells based on the condition, you need to use the COUNTIF function.

      But if this doesn't really suit your task, please describe it in detail. Feel free to share your sample data with us ( Please include the result you expect to get and shorten the tables to 10-20 rows.
      Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

      I'll look into your task and try to help.

  2. Ann T says:

    Natalia - this was very informative and easy to follow and apply.
    I would like to make a field that does word count (you showed this so don't require that) but always limits to a specific number of words (example 250).
    End use is to put in google docs for people to fill but with a word limit.
    Thanks in advance (if you are still connected to this page). In Google docs - Insert - Chart - From Sheets.

    • Hello Ann,

      Coulf you please give me more details on the task? Do you need to see the result only for those cells where the number of words doesn't exceed 250 chars? Or the other way around?
      Also, I'm not sure I understand the part where you need to put it to Google Docs. Do you need to put those calculations to a Chart?

  3. Brittany Jimenez says:

    Hi! Thank you for this.

    Would LEN be able to help me pick out all of the 5-character words out of a 2k+ spreadsheet? Like help create a filter that, when applied, only the relevant words show? I'm doing linguistic work on my indigenous language.

    I can provide a sample of my work below.

    Word Part of Speech Definition Grammar information: Example Translation

    ã^sah verb "(three or more) to be (in a place, temporarily);
    (one) to be sitting" intransitive, triplural
    ã^swah verb (two) to live (in a place), dwell intransitive, dual
    ã^wah verb to be yawning intransitive (done on purpose) or stative (not on purpose)
    a^yyukah verb all different, various, diverse stative, Y Grade
    aba' noun up, above the head, overhead; heaven
    aba' anũpa' noun the gospel
    aba' anũpa' dusúle' noun minister, evangelist, pastor est + anũpule
    aba' anũpa' ese' noun minister, pastor, Christian est + dalúa
    aba' anũpa' estanũpule' noun minister

    • Hi Brittany,

      I'm sorry, your example is a bit confusing. For me to be able to help you better, please share a small sample spreadsheet with us ( with 2 sheets: (1) a copy of your data (2) the result you expect to get (the result sheet is of great importance and often gives us a better understanding than any text description). I kindly ask you to shorten the tables to 10-20 rows.

      Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

      I'll do my best to help :)

  4. Vrunek says:

    Hi, thank you for the detailed article.

    I'm actually having trouble trying to apply the word count formula to multiple columns (about 20 consecutive columns) that include alphanumerics including dates like 22/02/2022 or February 22, 2022. I've tried the below formula but it doesn't work for numbers:

    Please help me out, I'd be grateful!

    • Hi Vrunek,

      For me to be able to help you, please share a small sample spreadsheet with us ( with 2 sheets: (1) a copy of your source data (2) the result you expect to get (the result sheet is of great importance and often gives us a better understanding than any text description). I kindly ask you to shorten the tables to 10-20 rows.

      Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

      I'll look into your task.

  5. Ro says:

    =SUM(LEN(M2:U2)) I have this formula on excel but need to do the same thing on google sheets. What would be the formula for google sheets?

  6. Dany says:

    Hi, how do I count the number of two words mentioned in 1 cell with full of sentences? Let say, I have "I have a dream (have a dream) A fantasy". If I would know how many "a dream" words mentioned in 1 cell and how to do it?

    Thanks, :)

  7. Adam F says:

    So I run a high ranking guild in a video game and keep track of everyone's attacks, draws, and losses when we fight other guilds. We have so many attacks and I keep track of everything in the format 'w,d,L' etc. and I have the track record spread over multiple rows. For example, I am using this string '=SUMPRODUCT(LEN(J186:W186)-LEN(SUBSTITUTE(J186:W186, "w", "")))' to calculate totals over a row but need to add the total between multiple rows. How do I add 2 different rows together in this formula? I apologize if I'm not as clear as I'd like to be about this.

    Essentially, I want to add that row with:
    =SUMPRODUCT(LEN(B222:F222)-LEN(SUBSTITUTE(B222:F222, "w", "")))

  8. Haley Hammond says:

    Hello! This was an excellent post with formulas I hope to try. Here’s what I’m hoping it could be used for-can you assist me in knowing if it will work? I have to sift through a lot of online reviews/comments and provide analysis on “how many times a reviewer used certain words-like “happy”, “angry”, compassionate, etc. my hope is to use one of these words in the string of cells to easily identify the count. I’m doing something else which is quite tedious.. many thanks in advance for your kind assistance!

  9. Prrr says:

    Thanks for this great post!! Very clear and informative.

    I have 1 question though...
    =LEN(A2)-LEN(SUBSTITUTE(A2, "s", ""))
    This formula is almost exactly what I need. Except, I dont want to count for "s", I want to count for the value in a specific cel (say C1, which will contain S). This is so I can easily change the S I am looking for into a different letter.
    But I cannot seem to adjust the formula to make it count the text in a cell...

    Curious to see if you have a solution.
    Thanks in advance!

Post a comment

Thank you for your comment! When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to your query. We cannot guarantee that we will answer every question, but we'll do our best :)