How to Count Specific Characters in a Cell in Excel (4 Quick Ways)

Method 1 – Use the Excel LEN and SUBSTITUTE Functions to Count Specific Characters in a Cell

We are going to count the specific character “C” in the cells from column C.

excel count specific characters in cell

STEPS:

  • Select Cell D5.
  • Insert the formula:
=LEN(C5)-LEN(SUBSTITUTE(C5,"C",""))

Use of LEN & SUBSTITUTE Functions to Count Specific Character in Excel Cell

  • Hit Enter to see how the formula actually worked.
  • Drag down the Fill Handle.

Formula Breakdown:

  • LEN(C5)
    This will count the number of characters in Cell C5.
  • SUBSTITUTE(C5,”C”,””)
    Then it will replace all the letters “C” with a blank in Cell C5.
  • LEN(SUBSTITUTE(C5,”C”,””))
    This will count the number of characters from the substitution.
  • LEN(C5)-LEN(SUBSTITUTE(C5,”C”,””))
    This will subtract the number of characters in the substitution from the total number of characters.

Read more: How to Count Specific Characters in a Column in Excel


Method 2 – Counting Specific Characters in Upper or Lower Case in Excel Cell

Case 2.1 – Upper Case Occurrence

We have the same PRODUCT dataset.

Upper Case Occurrence

STEPS:

  • Select Cell D5.
  • Use the following formula:
=LEN(C5)-LEN(SUBSTITUTE(UPPER(C5),"C",""))

Upper Case Occurrence

  • Hit Enter to see the result.

Formula Breakdown:

  • UPPER(C5)
    This will convert all letters of a text string (Cell C5) into uppercase.
  • SUBSTITUTE(UPPER(C5),”C”,””)
    This will replace all the letters “C” into a blank in Cell C5.
  • LEN(SUBSTITUTE(UPPER(C5),”C”,””))
    This will count the number of characters without the letter C in Cell C5.
  • LEN(C5)-LEN(SUBSTITUTE(UPPER(C5),”C”,””))
    This will give the result.


Case 2.2 – Lower Case Occurrence

We have a PRODUCT worksheet with a combination of uppercase and lowercase letters.

Lower Case Occurrence

STEPS:

  • Select Cell D5.
  • Use the formula:
=LEN(C5)-LEN(SUBSTITUTE(LOWER(C5),"c",""))

Lower Case Occurrence

  • Press Enter.

Formula Breakdown:

  • LEN(C5)
    This will count all the characters in Cell C5.
  • LOWER(C5)
    This will convert all letters of a text string (Cell C5) into lowercase.
  • SUBSTITUTE(LOWER(C5),”c”,””)
    Now in Cell C5, this will replace all the letters “c” into a blank.
  • LEN(SUBSTITUTE(LOWER(C5),”c”,””))
    This will count the number of characters without the letter c in Cell C5.
  • LEN(C5)-LEN(SUBSTITUTE(LOWER(C5),”c”,””)
    This will subtract the number of characters without the letter “c” from the total number of characters.

Read More: How to Count Alphabet in Excel Sheet


Method 3 – Use of Excel SUMPRODUCT, LEN, and SUBSTITUTE Functions to Count Specific Characters in a Cell

We are going to count the total number of a specific character “C” from the range C5:C8.

Use of Excel SUMPRODUCT, LEN & SUBSTITUTE Functions to Count Specific Characters in Cell

STEPS:

  • Select Cell E5.
  • Use the formula:
=SUMPRODUCT(LEN(C5:C8)-LEN(SUBSTITUTE(C5:C8,"C","")))

Use of Excel SUMPRODUCT, LEN & SUBSTITUTE Functions to Count Specific Characters in Cell

  • Hit Enter to see the result.

Formula Breakdown:

  • SUBSTITUTE(C5:C8,”C”,””)
    This will replace all the letters “C” into a blank in the range C5:C8.
  • LEN(SUBSTITUTE(C5:C8,”C”,””))
    This will count the number of characters without the letter C in the range C5:C8.
  • LEN(C5:C8)
    This will count all the characters in the range C5:C8.
  • LEN(C5:C8)-LEN(SUBSTITUTE(C5:C8,”C”,””))
    This will subtract the number of characters without the letter “C” from the total number of characters.
  • SUMPRODUCT(LEN(C5:C8)-LEN(SUBSTITUTE(C5:C8,”C”,””)))
    This will sum up the total array and return the result.

Read More: How to Count Space Before Text in Excel


Method 4 – Apply VBA to Count Specific Characters in an Excel Cell

We have to count the character “C” from the below dataset.

Apply VBA to Count Specific Characters in an Excel Cell

STEPS:

  • Right-click on the worksheet name.
  • Select View code.

Apply VBA to Count Specific Characters in an Excel Cell

  • A VBA Module window pops up.
  • Insert this code in the module.
Option Explicit
Dim x As Integer
Dim a As String
Dim b As Object
Dim y As Integer
Sub a_x()
x = 0
a = InputBox("character(s) to find?")
If a = "" Then GoTo Done
For Each b In Selection
y = InStr(1, b.Value, a)
While y <> 0
x = x + 1
y = InStr(y + 1, b.Value, a)
Wend
Next b
MsgBox x & " instance of " & a
Done:
End Sub
  • Select the Run option.

Apply VBA to Count Specific Characters in an Excel Cell

  • We can see a small Excel message window.
  • Type the required specific character “C” in the blank box.
  • Click OK.

Apply VBA to Count Specific Characters in an Excel Cell

  • The result appears in a window.

Read More: Excel VBA: Count Characters in Cell


Download the Practice Workbook


Related Articles


<< Go Back to Count Characters in Cell | String Manipulation | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Nuraida Kashmin
Nuraida Kashmin

Nuraida Kashmin, Bachelor's degree in Mechanical Engineering from Rajshahi University of Engineering & Technology. Since 2021, she wrote 45+ articles on Excel problems and reviewed over 1000 articles. Currently working as a Project Manager, she is responsible for developing and implementing content strategies, managing writers and editors, staying updated on new technology, analyzing data, and tracking content performance indicators. Her interests include Project Management, Creative Writing, Digital Marketing, Reporting, Monitoring & Documentation, and Online Advocacy for SAP &... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo