Note: The other languages of the website are Google-translated. Back to English
English

## How to count the number of characters, letters and numbers in cell?

When you type a list of data in a cell in Excel as shown as below screenshot, you want to count the total number of all characters, or only the number of the letters, or only the numbers in the cell. Now, I talk about the methods on this count in Excel.

If you want to count the total number of all characters, including numbers, letters and other marks in each cell, do it as follow:

1. Type this formula =LEN(A1) (the Cell A1 indicates the cell you want to count the total characters) into a blank cell, for example, the Cell B1, and click Enter button on the keyboard, and the total number of characters in Cell A1 has been counted. See screenshot:

2. Drag the fill handle to apply this formula to the range cells, and the number of characters in each cell of the list have been counted. See screenshot:

If you only want to the amount of letters excluding numbers in each cell, you can do as follow:

Select a blank cell, for example, the Cell B1, type this formula  =LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE
(A1,0,""),1,""),2,""),3,""),4,""),5,""),6,""),7,""),8,""),9,""))
(the Cell A1 indicates the cell you want to count amount of letters except numbers, you can change it as you need), then press Enter and drag the fill handle to fill the range you want to use this formula. See screenshot:

Select a blank cell, for example, the Cell B1, type this formula =SUM(LEN(A1)-LEN(SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9,0},))) (the Cell A1 indicates the cell you want to count only amount of numbers, you can change it as you need), then press Enter and drag the fill handle to fill the range you want to use this formula. See screenshot:

With this function, you not only can know how many letters or numbers in the string of the cell, but also know the orders of the letters and numbers.

1. Hold ALT button and press F11 on the keyboard to open a Microsoft Visual Basic for Application window.

2. Click Insert > Module, and copy the VBA into the module.

VBA: Count amount of letters and numbers with function

``````Function AlphaNumeric(pInput As String) As String
'Updateby20140303
Dim xRegex As Object
Dim xMc As Object
Dim xM As Object
Dim xOut As String
Set xRegex = CreateObject("vbscript.regexp")
xRegex.Global = True
xRegex.ignorecase = True
xRegex.Pattern = "[^\w]"
AlphaNumeric = ""
If Not xRegex.test(pInput) Then
xRegex.Pattern = "(\d+|[a-z]+)"
Set xMc = xRegex.Execute(pInput)
For Each xM In xMc
xOut = xOut & (xM.Length & IIf(IsNumeric(xM), "N", "L"))
Next
AlphaNumeric = xOut
End If
End Function
``````

3. Save the code and close the window, and type this formula =AlphaNumeric(A1) ( the Cell A1 indicates the cell you want to count, you can change it as you need) into a blank cell, then press Enter and drag the fill handle to fill the range you want to use this formula. See screenshot:

Tip:

(1) The "L" indicates letter and "N" indicates number.

(2) This function does not work with cells containing special marks, such as !, @, #, \$, %, ^, &, etc.

If you want to count the number of a specific character in a string, for example, in the string “I want to count the number of a specific in a string”, I want to count the number of character “n”, how can you do?

In this case, I introduce Kutools for Excel’s COUNTCHAR function for you.

 with more than 300 handy functions, makes your jobs more easier. Free DownloadFull future 30 days free trial

After installing Kutools for Excel, please do as below:

1. Type the character you want to count in a cell, see screenshot:

2. Then select a blank cell to put the result and select a blank cell which will put the counting result, and click Kutools > Kutools Functions > Statistical & Math > COUNTCHAR. See screenshot:

3. Then in the popping Function Arguments dialog, select the string into Within_text box, and select the character cell into the Find_text box. Then you can see the counting result appears in the dialog.

4. Click OK, now the result is put in the cell you select.

In Kutools Functions, you can count data by background or font color, you can sum values by same background or font color, you can convert time to decimal hours/minute/seconds and so on.

#### Count times a word appears in an excel cell

If a word appears several times in a cell which needed to be count, usually, you may count them one by one. But if the word appears hundreds of times, the manually counting is troublesome. The Count times a word appears function in Kutools for Excel's Formula Helper group can quickly calculate the count of times a word appear in a cell. Free trial with full features in 30 days!

Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.

### The Best Office Productivity Tools

#### Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

• Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
• Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
• Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
• Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
• Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
• Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
• Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
• Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
• More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.

#### Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

• Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
• Open and create multiple documents in new tabs of the same window, rather than in new windows.
• Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi this is stephen, I have a Query in excel in one cell contains alpha and Numbers like cell 1: Name(123) cell 2 : Name (456) how count as a 2 (Numbers) in two different cells Like (123) =1 and (456)=2
This comment was minimized by the moderator on the site
Hello Am Pallavi here, Even i wanted to know the formula for the above one. Kindly help Us please
This comment was minimized by the moderator on the site
Hi there,

I was wondering if somebody could assist with a formula, please. I am looking for count days of week, represented by letters in a range of cells. M stands for Monday. T stands for Tuesday. W - Wednesday. TH - Thursday. F for Friday. When staff do a range of days selected, M-F or W - TH, how would one account for that? Also, I have different types of days off staff take. For example, some of the entries are DD15-19 or V5-8. How would I ask excel to identify these different types of days and count the numeric rages and letter ranges?

Thank you,
This comment was minimized by the moderator on the site
Dear Experts, Please guide. Product Code Qty/Box Pencil 51AB 10 G. Total 10 I have received purchase of product " Pencil " with Code 51AB, but i have posted in my system in OLD code which is 41AB. Now company system stock reports shows 10 Box with new Code ( 51AB ), but our internal system stock report showing stock in OLD code 41AB. what is the formula that i calculate these 2 different code in one code either it is new or old code. Kindly help out. Thanks
This comment was minimized by the moderator on the site
To my opinion, the suggested formula for counting the amount of only digits with LEN function can be tremendously shorten !
=SUM(LEN(A1)-LEN(SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9,0},)))
----------------------------
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” Excel MVP – Excel (2009-2018)
ISRAEL.
This comment was minimized by the moderator on the site
Hi excel experts, can you help me?
I need to count previous numbers before special characters appeared.

123456789|

Could you help me?

Thank you.
This comment was minimized by the moderator on the site
Your question is a little complex, I cannot find a formula to solve it. But you can handle it like these:

1. Extract all characters before the special character =LEFT(A1,FIND(",",A1)-1), the comma is the special character

2. Then use the formula =LEN(A1)-LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE
(A1,0,""),1,""),2,""),3,""),4,""),5,""),6,""),7,""),8,""),9,"")) to count the numbers only.
This comment was minimized by the moderator on the site
Hi, i need to count numbers situated between characters, like in the example bellow, help me please.

example: 1,2,3,4,5,67,89,8657,6789,23456,10

i have 11 numbers situated between comma, is there a formula for this type of counting?

Thank you.
This comment was minimized by the moderator on the site
Hi, sorry for late answer, for solving the problem that counting numbers situated between characters, you can use =LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1),",",""))+1 this formula, A1 is the cell contains the string, for more details, please read this turorial:
https://www.extendoffice.com/documents/excel/3134-excel-count-comma-separated-values-in-a-single-cell.html
This comment was minimized by the moderator on the site
Thankyou very much :) you helped me
This comment was minimized by the moderator on the site
hi need a help eg: =+1+2+3+4+5+6 now i want how many numbers in a common cell . Is that possible .Still i am not able to find any solution m keep searching from last 4 months . May Be you provide a better solution
This comment was minimized by the moderator on the site
You can add' in the front of =1+2+3+4+5+6 to convert the formula to text, then apply Kutools for Excel's Remove by character to remove all characters except numbers, and use =LEN() to count the number.
This comment was minimized by the moderator on the site
Hi excel experts, is there some easy coding to count characters how often characters come in line. for example if I have the following line:
ABBABBCCCBCCBCCCBB and I want to know how many times there are three (3) C in a row? in this case the correct answer is 2 times. But I would like to write a code to counts for me. It is possible?
This comment was minimized by the moderator on the site
Sorry, I do not have any tricks on solving this job.
This comment was minimized by the moderator on the site
Put string ABBABBCCCBCCBCCCBB to A1 and string CCC to B1. Now put fthis formula to C1: =(LEN(A1)-LEN(SUBSTITUTE(A1;B1;"")))/LEN(B1)
This comment was minimized by the moderator on the site
Hi excel experts,
Count only numbers within a cell, excluding letters & other characters
So, let's say we have 1, 4, 5, 6. I'd like A2 to show "4".

Formula used =SUM(LEN(X4)-LEN(SUBSTITUTE(X4,{1,2,3,4,5,6,7,8,9,0},))) so, Will be single digit OK. but two digit wrong formula.

But Double digit number how to count...?

so any double digit number, e.g., 10
This comment was minimized by the moderator on the site
Hi，vivek kachhadiya, you can use =EXTRACTNUMBERS(cell) to extract all numbers from string to a cell, then use =LEN(cell) to count the number of numbers.
See screenshot:
This comment was minimized by the moderator on the site
Hello, How can I check for password validation that is stored as excel cell data using vba script and display message for all the wrong entries showing the location of error?
This comment was minimized by the moderator on the site
I thank you for how I understand what that meant?
This comment was minimized by the moderator on the site
It was a little Confusing but I knew this will be a good help for me because I just knew typing like coding this was such a good idea in order thx very much.
This comment was minimized by the moderator on the site
1+2+3+4+5+6 I need help with this one. How can I ACTUALLY figure this out...?
This comment was minimized by the moderator on the site
Can solve it for me.. Iwant count of this cell :-
1+1.5+2+1.5+2.5+1+3+3.5

1=?, 1.5=?, 2=?, 2.5=?, 3=?, 3.5=?... using LEN but ans.wrong (1=4, 1.5=2, 2=2, 2.5=1, 3=2, 3.5=1)