How to count the number of characters, letters and numbers in cell?
When managing data in Excel, it is often necessary to analyze the textual content of cells—for example, by counting the total number of characters, isolating just the letters, or focusing solely on digits. In this guide, you will learn various techniques for counting the total number of characters, the specific count of letters, numbers, or even special characters in a cell. Each method offers distinct features and benefits depending on your specific scenario, from straightforward Excel formulas and built-in features to VBA and advanced functions. Below you will also find supplemental solutions for advanced automation and conditional formatting tasks.

Count amount of all characters except numbers with LEN function
Count amount of only numbers with LEN function
Count amount of letters and numbers with function
Count the number of a specific character with COUNTCHAR function

VBA: Count letters, numbers, and specific character types (uppercase, lowercase) in cell
Conditional Formatting: Highlight cells exceeding character or number thresholds
Count amount of characters with LEN function
If you want to count the total number of all characters, including numbers, letters, spaces, and all other symbols in each cell, you can use the LEN function. This is useful in scenarios such as enforcing text limits on form fields or preparing data for import where character limits apply.
1. Type the following formula in a blank cell (for example, in cell B1 if your data is in cell A1):
=LEN(A1)
Press Enter, this will display the total number of characters, including spaces and punctuation, in cell A1.
2. Drag the fill handle down or across to apply the formula to other cells. This allows you to batch count characters in each cell of your list for quick validation or review.

Unlock Excel Magic with Kutools AI
- Smart Execution: Perform cell operations, analyze data, and create charts—all driven by simple commands.
- Custom Formulas: Generate tailored formulas to streamline your workflows.
- VBA Coding: Write and implement VBA code effortlessly.
- Formula Interpretation: Understand complex formulas with ease.
- Text Translation: Break language barriers within your spreadsheets.
Count amount of all characters except numbers with LEN function
If you only want to count the number of characters that are not numbers (for example, counting only alphabets and punctuation), use the following approach. This is useful when you need to extract textual data and ignore numerals, such as for certain compliance or reporting rules.
Select a blank cell, such as B1, and 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,""))
(Replace A1 with your target cell if needed.) After entering the formula, press Enter and use the fill handle to copy the formula to the rest of your range. This will provide the count of all characters except digits in each cell.
Tip: If you encounter errors or unexpected results, double-check for hidden characters such as line breaks or non-breaking spaces, as they may affect the character count.
Count amount of only numbers with LEN function
Sometimes, you may need to know precisely how many digits appear in a cell, ignoring all other types of characters. This is especially relevant in data cleaning where you need to identify cells containing the expected number of numerical digits, like ID numbers or codes.
In a blank cell, such as B1, enter the following formula:
=SUM(LEN(A1)-LEN(SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9,0},)))
Press Enter to calculate the result, and use the fill handle to copy the formula to other cells as required.
Count amount of letters and numbers with function
This approach provides not just the total counts, but also identifies the order of letters and numbers in the cell content. It is especially useful if you need to validate the structure of codes, serial numbers, or mixed alphanumeric sequences.
1. Hold the ALT key and press F11 to access the Microsoft Visual Basic for Applications window.
2. In the VBA editor, click Insert > Module, then paste the provided VBA code into the module window.
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 VBA code and close the editor. Enter the formula =AlphaNumeric(A1) in a blank cell (replace A1 as needed), and press Enter. Use the fill handle to copy the formula as required.
Tips:
(1) "L" stands for letter and "N" stands for number.
(2) This VBA does not process special symbols such as !, @, #, etc. For strings that combine different character sets, consider preprocessing your data or using updated VBA solutions as detailed in later sections.
Count the number of a specific character with COUNTCHAR function
If your task involves counting how often a particular character (such as "n" or any other symbol or letter) appears in a string, you can use the Kutools for Excel COUNTCHAR function, which streamlines the process with an easy-to-use interface. This is especially efficient when you frequently need such counts or want to minimize manual formula management.
After installing Kutools for Excel, follow these steps:(Free Download Kutools for Excel Now!)
1. Enter the character you wish to count in a cell.
2. Choose a blank cell for the result and click Kutools > Kutools Functions > Statistical & Math > COUNTCHAR.
3. In the Function Arguments dialog, select the source text cell in Within_text, and the character cell in Find_text. The counting result displays instantly.
4. Click OK, the result will appear in the selected cell.
In Kutools Functions, you can also summarize or manipulate data based on background/font color and perform fast time data conversions for further convenience, helping you simplify complex operations in Excel.
Count the times of a specific character appears in a string
VBA: Count letters, numbers, and specific character types (uppercase, lowercase) in cell
This method is suitable when you want a highly customizable count—for example, distinguishing between uppercase/lowercase letters or isolating symbols, digits, or even whitespace. It's ideal for audits, complex data validation, or when analyzing data consistency across large datasets.
1. Click Developer > Visual Basic to open the VBA editor, then click Insert > Module and paste the following code into the module:
Function CountCharType(cell As Range, Mode As String) As Long
Dim i As Integer
Dim s As String
Dim res As Long
On Error Resume Next
xTitleId = "KutoolsforExcel"
s = cell.Value
Mode = LCase(Mode)
res = 0
For i = 1 To Len(s)
Select Case Mode
Case "letter"
If Mid(s, i, 1) Like "[A-Za-z]" Then
res = res + 1
End If
Case "number"
If Mid(s, i, 1) Like "[0-9]" Then
res = res + 1
End If
Case "uppercase"
If Mid(s, i, 1) Like "[A-Z]" Then
res = res + 1
End If
Case "lowercase"
If Mid(s, i, 1) Like "[a-z]" Then
res = res + 1
End If
Case "space"
If Mid(s, i, 1) = " " Then
res = res + 1
End If
Case "symbol"
If Not (Mid(s, i, 1) Like "[A-Za-z0-9 ]") Then
res = res + 1
End If
End Select
Next
CountCharType = res
End Function
2. In your worksheet, use a formula in a blank cell such as =CountCharType(A1, "uppercase")
. You can also use "letter"
, "number"
, "lowercase"
, "space"
, or "symbol"
to get specific counts. Press Enter and drag the formula down to apply it to other rows if needed.
Conditional Formatting: Highlight cells exceeding character or number thresholds
Conditional Formatting can be used to visually identify cells meeting certain character count criteria, such as flagging entries longer than a certain number of characters, or containing more than a specified number of digits. This is valuable for quality control, reviewing survey responses, generating warnings about invalid entries, or auditing imported data.
For example, to highlight all cells where the character count exceeds18:
1. Select the range you want to analyze (e.g., A1:A100).
2. Click Home > Conditional Formatting > New Rule.
3. Choose Use a formula to determine which cells to format and enter this formula:
=LEN(A1)>18
4. Click Format, choose a highlighting style, and click OK to apply. The cells will now stand out if their contents exceed18 characters.
Similarly, you can set up a rule to highlight cells containing more than5 digits (numbers):
=SUMPRODUCT(--ISNUMBER(FIND(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),"0123456789")))>5
Enter this as the conditional formatting formula. Replace 5
with another threshold as needed. This method is best for visual monitoring and instant feedback in large lists.
Note: Conditional formatting doesn't show a count directly, but is excellent for review and data quality tasks.
Applying and combining these solutions allows you to perform both simple and advanced text analytics within Excel. When working with multi-lingual data or cells containing non-standard characters, results might differ—especially if special Unicode characters or unexpected whitespace are present. For dynamic analysis or repetitive tasks, consider saving advanced formulas or VBA to your personal macro workbook.
Relative Articles:
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
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!
All Kutools add-ins. One installer
Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.





- All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
- One installer, one license — set up in minutes (MSI-ready)
- Works better together — streamlined productivity across Office apps
- 30-day full-featured trial — no registration, no credit card
- Best value — save vs buying individual add-in