How to count the number of characters in Excel cells

Want to know how many characters there are in a certain cell? This tutorial will help you choose an Excel formula for character count best suited for your particular case.

Initially, Excel was designed to work with numbers. Fortunately, the developers of this helpful application didn't forget about text. Below, you'll find a number of formulas for counting characters in Excel. Just look through the examples and see which one best suits your needs.

Here are the cases we are going to cover:

Excel formula to count the number of characters in a cell

First things first, let's solve the most common case. To find how many characters there are in an Excel cell, the formula is as simple as:


For example, to count characters in each cell of column A beginning in A3, this is what you need to do:

  1. Enter the below formula in any empty cell in row 3:


  2. Double-click the fill handle to get the formula copied across the whole column.


Feel free to use this formula each time you need to count the number of characters in a string. Excel formula to count the number of characters in a cell

Note. Please pay attention that the Excel LEN function counts absolutely all characters in a cell, including letters, numbers, punctuation marks, special symbols, and all spaces (leading, trailing and spaces between words).

Count characters in a range of cells

To get the total of characters in an Excel range, you can use the LEN function together with SUMPRODUCT:


And your real-life formula may look similar to this:

=SUMPRODUCT(LEN(A3:A18)) Count characters in a range of cells

Another way to count all characters in a range is using LEN in combination with the SUM function:


Unlike SUMPRODUCT, the SUM function does not process arrays by default, so you need to press Ctrl + Shift + Enter to turn it into an array formula in Excel 2019 and earlier. In Excel 365 and 2021, it works as a regular formula due to inbuilt support for dynamic arrays.

How this formula works:

The logic is very simple. The LEN function calculates the string length for each individual cell in the specified range and returns an array of numbers. And then, SUMPRODUCT or SUM adds up those numbers and returns the total character count.

How to count specific characters in a cell

To find out how many times a given character appears in a cell, the generic formula is:

LEN(cell) - LEN(SUBSTITUTE(cell, character, ""))

Suppose you maintain a database of items where each item type has its own unique identifier. And each cell contains several items separated by comma, space, or any other delimiter. The task is to get the number of occurrences of a certain unique identifier in each cell.

Assuming the list of items is in column A beginning in A3, and the target character is in column B in the same row, the formula is as follows:

=LEN(A3) - LEN(SUBSTITUTE(A3, B3, "")) Excel formula to count specific characters in a cell

Note. Excel's SUBSTITUTE is a case-sensitive function, and therefore the above formula treats uppercase and lowercase letters as different characters. For example, cell A4 in the screenshot above contains one occurrence of "a" and two occurrences of "A". The formula counted only the uppercase "A" and returned 2 as the result.

How this formula works:

To understand the formula's logic, let's break it down into smaller parts:

  • First, you find the total string length in cell A3 with:
  • Then, you remove all occurrences of the letter "A" in A3 by replacing it with an empty string:
    SUBSTITUTE(A3, "A", "")
  • The next step is to find the string length without the letter "A":
    LEN(SUBSTITUTE(A3, "A", ""))
  • Finally, you subtract the length of the string without "A" from the total length string:
    LEN(A3) - LEN(SUBSTITUTE(A3, B3, ""))

As the result, you get the count of "removed" characters, which is the number of occurrences of that particular character in the cell.

Case-insensitive formula to count letters in Excel cell

When counting letters in Excel cells, you may sometimes need a formula that ignores the letter case. To make such a formula, use the UPPER function inside SUBSTITUTE to convert a given letter to uppercase before running the substitution.

For example, to count both "A" and "a" in cell A3, use this formula:


The LOWER function will also do:

=LEN(A3) - LEN(SUBSTITUTE(LOWER(A3), "a", ""))

A slightly more complex way is using nested SUBSTITUTE functions:

=LEN(A3) - LEN(SUBSTITUTE(SUBSTITUTE (A3, "A", ""), "a", "")

In our data set, the letters to be counted are input in column B, so we convert both the source cell and the cell containing the character to uppercase:


And this works beautifully irrespective of the target letter's case: Case-insensitive formula to count letters in Excel cell

How to count certain text/substring in a cell

If you want to know how many times a certain combination of characters appears in a given cell (e.g. "C2" or "C-2" or "cat"), then divide the characters count by the length of the substring.

Case-sensitive formula:

=(LEN(A3) - LEN(SUBSTITUTE(A3, B3, ""))) / LEN(B3)

Case-insensitive formula:


Where A3 is the original text string and B3 is the substring to count. Count the occurrences of certain text in a cell.

For the detailed explanation of the formula, please see How to count specific text / words in a cell.

How to count specific characters in a range

Knowing a formula for counting certain characters in a single cell, it's quite easy to modify it a little further to count the number of occurrences of a given character in several cells. For this, just place the LEN formula inside the SUMPRODUCT function that can handle arrays:

SUMPRODUCT(LEN(range) - LEN(SUBSTITUTE(range, character, "")))

For example, to get to know how many times the character in D2 occurs in the range A3:A18, the formula is:

=SUMPRODUCT(LEN(A3:A18) - LEN(SUBSTITUTE(A3:A18, D2, ""))) Count the number of occurrences of a certain character in a range.

Instead of SUMPRODUCT, you can also use SUM:

=SUM(LEN(A3:A18) - LEN(SUBSTITUTE(A3:A18, D2, "")))

But this formula requires pressing Ctrl + Shift + Enter because, in all versions other than Excel 365 and 2021, SUM can handle arrays only in an array formula.

How this formula works:

The SUBSTITUTE function replaces all occurrences of a given character ("A" in this example) with an empty string ("").

The text string returned by SUBSTITUTE is served to the LEN function so it calculates the string length without A's.

The string length without A's is subtracted from the total length of the original string. The result is an array of character counts per cell.

Finally, SUMPRODUCT sums the numbers in the array and returns the total character count in the range.

Case-insensitive formula to count letters in a range

To create a case-insensitive formula for counting specific characters in a range, follow the same approaches that we used for counting certain letters in a cell regardless of the text case.

Use the UPPER function and supply an uppercase letter:


Use the LOWER function and supply a lowercase letter:


Nest a couple of SUBSTITUTE functions one into another:

=SUMPRODUCT(LEN(A3:A18) - LEN(SUBSTITUTE(SUBSTITUTE((A3:A18), "A", ""), "a", "")))

In the character of interest is input in a predefined cell, UPPER or LOWER will work equally well:




The below screenshot shows it in action: Case-insensitive formula to count certain letters in a range.

How to count certain text / substring in a range

To count the number of occurrences of certain text in a range, use this generic formula:

SUMPRODUCT((LEN(range) - LEN(SUBSTITUTE(range, text, ""))) / LEN(text))

For example, to count the number of times the word "Life" appears in the range A3:A18, the formula is:

=SUMPRODUCT((LEN(A3:A18) - LEN(SUBSTITUTE(A3:A18, D2, ""))) / LEN(D2)) Count the occurrences of certain text in a range. In the above screenshot, only the word "Life" is counted, but not "life". However, you can force the formula to disregard the letter case with the help of either the UPPER or LOWER function. To see how this works, please visit How to count specific words in a range.

Excel character limits for cells

Microsoft Excel has a limitation on the number of characters that can be entered in a cell. If you have worksheets with large amount of text data, you may find the following information helpful.

  • The total number of characters that a cell can contain is 32,767.
  • A cell can only display 1,024 characters. At the same time, the Formula bar can show all 32,767 symbols.
  • The maximum length of a formula is 8,192 characters in Excel 2007 and higher (1,014 in Excel 2003).

Please consider the facts when you are going to merge or import data from an external source.

These are the best practices for counting characters in Excel. For first-hand experience, you can download a sample workbook and check out a list of related resources at the end of the page. Thank you for reading and hope to see you soon!

Practice workbook for download

Count characters in Excel - formula examples (.xlsx file)

You may also be interested in


  1. Dear support,
    I have big sheet.there is contain text id..when i filter sheet i cannot get total count of filtered text...

    • Hello,

      If I understand your task correctly, please try the following formula:


      Hope it will help you.

  2. Hey I want to make shift schedule.. there are 40 members are there. I want to make sum for in any row or column if I will write down for example "m" i total how many "m" are there in row and column. please help me.

  3. Hi,

    I have data look like this below


    How do I do the countif wihtout the numeric? I just want to know how many count for R, P, PX and SO? Your help is appreciated. Thanks!

    • Hi, Amanda,

      if the data is situated in A1:A5, use the following formula to count the number of cells with R at the beginning of the cell:

      To count the rest of the values simply change R in the formula to other letters.

      You can read more about COUNTIF function on our blog post here.

      =LEFT(TEXT CELL,MIN(FIND({1,2,3,4,5,6,7,8,9,0},TEXT CELL&"1234567890")-1))

      =SUBSTITUTE(TEXT CELL, LEFT(TEXT CELL,MIN(FIND({1,2,3,4,5,6,7,8,9,0},TEXT CELL&"1234567890"),"")


  4. Hi,

    I’m working in one of the Trading Company, regularly need to prepare the delivery note report in Excel. Delivery note number is like D17/H0001. So can you please any one of them to provide code for add delivery note number +1.
    For example “D17/H00001”, Next row should be “D17/H00002”. I need the code only.
    Appreciate for your Help!

  5. I need help with using Excel 2010 on a formula that will display how many spaces and characters combined are in each cell with a text file. Your help is appreciated.


  6. hI,
    I have a workbook with 20 worksheets.In each worksheet I want to tally the amount of times the user selects from a drop down box of 10 options.I want to calculate the number of times each option is used on each worksheet and grand tally on the cover sheet.
    Please help

  7. How to Sum of this data

    4 hours
    8 hours
    3 hours
    6 hours

    • Hello, Yogender,

      at first, please make sure that the Time format is applied to your values.
      Then, if the data starts in A2, use the following formula:

      If the values are not in the cells use the following:

  8. Im trying to count cells that contain numbers and text is this possible?
    I just want to get the sum of the numbers in each cell but there is text also in this cell.

  9. TOTAL MONTH OF PRESENT WORKERS FOR EX. P (1TO 15TH DAYS) & ABSENT A (16th to 31st)days in excel.

    i have any help for using the formulas in this cell sum total. separate total present days & total absent days

  10. I have a string of data, one number in its own cell which are mixed between numbers and H plus a number that we use for holidays on our timesheets, so may 6 H7 H7 7 8 8 How can I just record the numbers after the H so I can track the numbers of holidays being claimed?


  12. Can you help?
    I want to display the names of anyone with a "C" in a range of cells. So if any cells from A1:A10 has a "C" then A12 needs to display the name that is in cell A11, If there is not a "C" then no name will be displayed..

    Thank you!!

  13. I have past my data in one cell for E.g cell A2 1.aaaaa
    I want to apply formula for calculate the no of Pointer mention in one cell can any one suggest me how to drived No. .....

  14. how to count different alphabet if many rows..



  15. Dear Svetlana,

    i have a small query, i have a attendance sheet like below:-

    Name Code 01-Dec 02-Dec 03-Dec 04-Dec 05-Dec 06-Dec 07-Dec Total C/L
    xxxx xx P 3/4 C/L P 1/2 C/L; 1/2 S/L C/L W/O P ?

    i want to count total C/L, but in this numaric data is there with C/L.
    pls suggest.

    thanks in advance.

  16. Hi Maria,

    Hope you are doing well, I am a basic excel user, I am handling an excel work book in 2016 version, I've got a query as follows:

    I have 9 worksheets in an excel book and a specific column in each sheet which displays a series of reference numbers as:


    and so on, Please note: these numbers are not following any sequence. I want to count the number of times the second last series of number is appearing. In this Instance

    0114 is 3 times
    0119 is 3 times
    0233 is 3 times &
    1568 is 3 times

    I want to count this by a formula and get the result in any other cell as a counter. I'll appreciate if you could help me in this please.

    • Hi Syed,

      You should use the following formula to count all cells with "0114":
      =CONCATENATE("0114 is ", SUMPRODUCT((MID(A1:A12, FIND("-", A1:A12, LEN(A1:A12) - 8) + 1, 4) = "0114") * 1), " times")
      You can change this formula and use it to count cells with "0119", "0233", etc.

  17. hey i want to do the validation of PAN no. i.e. in between first five char are alfabets, next four are numeric & last one is also alfabet. its total 10 digit of no. so how can I check multiple PAN nos. at one tym. please tell me the formula.

    • Hi dinesh,

      You should use the following formula:
      =AND(NOT(ISERROR(SUMPRODUCT(SEARCH(MID(LEFT(A1, 5),ROW(INDIRECT("1:"&LEN(LEFT(A1, 5)))),1),"abcdefghijklmnopqrstuvwxyz")))), NOT(ISERROR(VALUE(MID(A1, 6, 4)))), NOT(ISERROR(SUMPRODUCT(SEARCH(MID(RIGHT(A1, 1),ROW(INDIRECT("1:"&LEN(RIGHT(A1, 1)))),1),"abcdefghijklmnopqrstuvwxyz")))))

  18. Hello all, need a help i have text with drop down as follows in a cell
    5(Deliverables as per requirement)
    4(Deliverables with minor/cosmetic defects/bugs)
    3(Deliverables with minor/cosmetic defects/bugs but affected overall schedule)
    2(Deliverables with major defects/bugs)
    1(Deliverables with critical defects/bugs affected customer quality and schedule)
    i have different milestones(rows) with above drop down option now i want to sum all points for all rows.please let me know how SUM related cell consider above in numbers not text

    • Hi Puran,

      You should use the following formulas:
      =SUMPRODUCT((LEFT($A$1:$A$15, 1)="5") * 1)
      =SUMPRODUCT((LEFT($A$1:$A$15, 1)="4") * 1)
      =SUMPRODUCT((LEFT($A$1:$A$15, 1)="3") * 1)
      =SUMPRODUCT((LEFT($A$1:$A$15, 1)="2") * 1)
      =SUMPRODUCT((LEFT($A$1:$A$15, 1)="1") * 1)
      Please replace "$A$1:$A$15" with your own range.

  19. Hi,

    I have looked at all of the above and I am still lost and can only find the outcome of one piece of the calculation

    =COUNTIF(O8:O17,"24+") etc

    I would like excel to count the number of times the Age Group occurs and also the corresponding value when it comes up in the total. For example:

    The below shows the number of times each age range is repeated, however, It does not match the number of Apps required. I need it to add the corresponding value.

    "No. of Apps
    required " Age Group
    1 16-18
    1 16-18
    1 16-18
    1 16-18
    1 16-18
    1 24+
    13 24+
    1 16-18
    1 18+
    1 19+
    1 16-18

    16-18 7
    18 1
    19+ 1
    24+ 2

    Apps req 23

    So the outcome I am hoping to achieve is the sum of all group matches the sum of apps req.

    16-18 7
    18 1
    19+ 1
    24+ 14

    Apps req 23

    Can you help?

    • Hi Donaly,

      You should use the following formulas:
      =SUMPRODUCT((B1:B11="16-18") * A1:A11)
      =SUMPRODUCT((B1:B11="18") * A1:A11)
      =SUMPRODUCT((B1:B11="19+") * A1:A11)
      =SUMPRODUCT((B1:B11="24+") * A1:A11)
      If the "No. of Apps required" data are in B1:B11 and "Age Group" are in A1:A11.

  20. Hi

    I am trying to figure out how to combine a couple of countif's from two different columns to give me the answer in another cell.

    =COUNTIF(F5:F99; "*Red*") (so how many times"Red" is written in this particular series BUT i only want to know which "Red"s belong to a specific gender e.g this countif =COUNTIF(E5:E99; "*f*").

    I can't figure out how to combine them to prouduce a result that gives me all the 'f' in the columns E which are also "red"

    Would love your help.

    Thank you :)

  21. Vehicle Name Total KM
    Santro 15km
    Tavera 13km
    Swift 40km
    Indica 30km

  22. Hi, I am trying to format a cell if it contains EXACTLY 17 characters. I input Vehicle VIN numbers which contain letters & numbers, 17 ONLY.

    I need the cell to change color IF it has 17 characters. (Cells A2 thru A29

    • Hi ALLISON,

      Please try to do the following:
      1. Select cells A2:A29.
      3. Click Conditional Formatting -> New Rule.
      4. Select the "Use a formula to determine which cells to format".
      5. In the Formula field type the following formula:
      6. Click the Format button to set the format you need.
      7. Click OK.

  23. Hi,
    I have a cells with numbers and characters i.e. 2C, 5B. Please could you tell me the calculation to count up just the numbers and then seperately the characters?
    Many thanks

  24. Hi
    successfully I can get the count of repeated text in a range for example: I have a repeated letter "P" in the range A21:D123 50 times the function I made = sum(len(A21:D123)this will count successfully all text in this range .

    I am struggling in counting the occurrences of different letters in the same range what I need is to count the "P" individually and at the same time if there are A, C and N I also need their numbers in the same range. how can I do this?
    thanks in advance

  25. Dear Sir,
    How to find out the position of a word in a text string in excel 2013.
    Cell A1
    The cow has eaten the grass.
    Position of the word "cow" is 2.
    Position of the word "eaten" is 4.
    Position of the word "grass" is 6.

  26. i have three option in A column present, leave , late i whant if present or leave = 0 and if late then 20 add total of month.

  27. How can I count unique values among duplicates in a column? I have text that is duplicated on several rows. I need a total count of all text without counting duplicates.

  28. I have a excel of 4 columns and 90 rows, i want to compare this with another column having 180 rows and hence count the common in this 4 rows

  29. Hello!

    Just wanna how can I count a number which is double number, I have this numbers (1,2,3,4,5,11,23) and my problem was, the double number was counted separately. Instead of 7 it counted 9.

    Thank you very much!

  30. Some of the characters that have been written on the column if the column will come lekhata

  31. I Wish to get number value (example 5) in B1 cell from √ symbol in A1 cell

  32. formula worked fine but is not constant in the next cell below..... why is that. may I know how to let all the cells below function the same way I commanded the first cell above.

  33. if my cell is like below


    and I need to count " AF " is that possible to do? how? what formula will I have to use?

    Thank you.

  34. Hi guys,
    I have two columns in my spreadsheet - code(1-18) and duration in minutes (1-300)

    I need to get the sum of values(values in minutes) of the same code of cells. The code still in numbers (eg 1-18)

    Kindly someone help.

  35. I'm creating a spreadsheet (Excel 2003) in which a user enters data in several cells, each of which will permit only 50 numbers of characters (to include spaces). i have used data validation to limit cahracters to 50, but i want to show number of characters typed simultaneously. anyone please help me out. thanks in advance.

  36. 12251197-ltc-mun-transporte-ejecutivos-oriente-anibal-golindano-1900006354-m-i-swaco.xls

    i want to find employee no which is stat with 1900 and does not start with 1900.
    how can i want find both in one formula.

  37. I have cells with part numbers, I.E.
    I need formulas to find out how many odd numbers and even numbers I have total as they equate to left and right sides of an aircraft?

    • Hello, Gary,

      Please use the following formula for the odd numbers:

      The one for the even numbers:

      Here A1:A7 is your list address. Please note that these formulas are array formulas. Use Ctrl + Shift + Enter to enter them.

  38. Hi guys,

    I am using Excel 2010.

    I'd like to ask you for your kind support. I am looking for formula which calculate with text & no. (where no. is changing).


    I need to get in A2=A1+1 --> R00001

    Thank you in advance.


  39. I'm struggling to count a specific alphabet like "P" in a cell range of a few words.

  40. I know how to count a "V" in a cell for one, but I was wondering if there is anyway I can count it as .5 and as 1 too. What can I put to make it count as .5?

  41. 843,138FS+5d,411,416,766,132
    Each of these is in a separate cell, I'm trying to count those without SS or FF on the end. This is to count the number of FS relationships in an export from MS Project. I have been able to do the count of SS and FF.

  42. hi,
    i want to enter a number and after that some information appear.for example when i enter 570, after that some information in a row about weight,quality,tonnage or other things should provide. i use the custom list in excel option but the error (cells without simple text were ignored) appear. what should i do???
    please help me
    thank you

  43. Where I work we have to maintain a daily census that lets us know how many people are in the building, including residents and guests.

    I want to know if I when a name is added or removed how can I keep a running total.

    So in other words to make sure I am explaining myself, if a resident moves in, or passes away, or is in the hospital or a family member stays with us we have to know how many people (not staff) or in the building. So if right now I have 70 residents and tomorrow one goes to the hospital and one moves out my total should say 68. So how to I get the 70 to change from 68 using names of people not numbers. Right now if someone forgets to change the total manually then we could have problems. But if the number changes with a name added or removed it would help a lot. Thank you.

  44. How do I separate the text for the following
    hienze/adsfdsaf kt/feD.xl - "i need "feD.xl" in this
    asda/sfer/aedfew/rwtw/ - "i need "" in this"
    ewr/tye.tre - "i need "tye.tre" in this"
    Basically i need to get the text after the last "/" in every cell.
    Appreciate your help

  45. how to count only text.

    Now please count only text value. I tried but it counts space also.

  46. In an excel spreadsheet, if I have 5 cells in a row or column, 4 cells which have a number value and only one cell that has a text format, such as a name, how do I create a formula that will ignore cells with numbers and input the only text value as my answer?

    For instance,
    If C1 = 4, C2 = 6, C3 = 9, C4 = Quality Paving, C5 =2
    And I created a formula in another cell, such as Cell D14, with formula, =Sum(C1:C5), my value would be the sum of all the numbers. But I want my value in a certain cell to equal Quality Paving. What formula can you create that will ignore the number cells and give you the text value only as it is in another cell?

  47. Hi,
    Good information but i need additional help for filtered columns...

    I am trying to count the number of cells that have "X" (the X comes from a formula where the cell has this then an X goes into this cell (=IF(X1="LTI","X","")) in them but the column is filtered by year or month. So i only want to count the cells containing an X if they are displayed when filtered.

    really struggling with this.


    • Hello, Brad,

      Here's the fomula:

  48. hi,
    I have a one problem which I can't solve. I have about 10 sheets in one excel and in every sheet is an table which contain a rows with text. In the laste sheet I would like to summarize the whole from sheets but I don't know which formula I can use for do this. I want to count or sum the text accross the multiple sheets but I don't know how. Thanks for response!

    • Hello, Valentina,

      You need to add the references to other sheets. For example, here the formula for the number of text cells from 3 sheets (Sheet1, Sheet2, Sheet3) with data in A1:A10:
      =COUNTIF(Sheet1!A1:A10, "*") + COUNTIF(Sheet2!A1:A10, "*") + COUNTIF(Sheet3!A1:A10, "*")

      • Ms. Maria Azbel:

        What if you have a variety of names (instead of sheet 1, Sheet2)on your multiple sheets and you want to count or sum the text across those multiple sheets from one column; could you not use a formula that is like the First Last formula? =SUM(First:Last!D28)

        Would I do: =COUNTIF(First:Last!D28) ?

  49. hi
    would you please help me to find a equation in excel i have tried many times to find it i could not find. in a column there are different texts there are "/" in middle of some texts i want to avoid some letters from that texts that letters beyond the "/" and include "/" .i want to change below texts like
    eg: han/han han
    pan/san pan
    ran/man ran

    • Use this formula considering the values start from cell A1, B1 and so on:

      This formula finds the "/" character and displays all the text till that character and the "-1" removes the "/" character

    • How do I separate the text for the following
      hienze/adsfdsaf kt/feD.xl - "i need "feD.xl" in this
      asda/sfer/aedfew/rwtw/ - "i need "" in this"
      ewr/tye.tre - "i need "tye.tre" in this"
      Basically i need to get the text after the last "/" in every cell.
      Any help will be highly appreciated

      • This should work. I've written it as though your data begins in cell A1. Copy this formula down.


      • Whoops, I left out the piece before "SEARCH"...


  50. Hi Maria I have tried your solutions but in all cases where im trying to count cells with text in the formulas seems to include cells with formulas in, I have 1400 rows and I want to count the number of cells that match my formula IF(ISERROR(MATCH *** . the formula im using works as it compares names in two columns but now I want to total it up and all i get using your ideas it is the full row total. Is there a way of doing this and ignoring cells with formula ?

    • simple =len(text)

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 :)