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

Count cells that begin or end with specific text

This article is going to show you how to count cells that begin or end with specific text in a range in Excel with the COUNTIF function.

Count cells that begin with specific text in a certain range
Count cells that end with specific text in a certain range


The following formula can be used to deal with the two situations mentioned in this tutorial.

Generic Formula

=COUNTIF(range, criteria)

Arguments

Range (required): The range from which you want to count cells that begin or end with specific text;

Criteria (required): The text string you look for.


Count cells that begin with specific text in a certain range

The COUNTIF formula can help to easily count the number of cells that begin with specific text in a certain rang in Excel.

1. Select a blank cell to output the result.

2. Enter the below formula into it and press the Enter key. Select the result cell, and then drag the Fill Handle over the below cells to get the results for other criteria.

=COUNTIF($B$3:$B$9,D3)


Count cells that end with specific text in a certain range

Supposing you want to separately count the number of cells that end with character J or M in range B3:B9 as the below screenshot shown, you can do as follows.

1. Select a blank cell (E3 in this case) to place the result.

2. Enter the below formula into it and press the Enter key. Select this result cell and then drag its AutoFill Handle across the below cell to apply the formula.

=COUNTIF($B$3:$B$9,D3)

Now the number of cells that ends with specified character have been calculated as the above screenshot shown.

Notes:

1) $B$3:$B$9 is the range from which you want to count cells that begin or end with specific text.
2) D3 is the cell containing the text string you are looking for. Please change them as you need.
3) The asterisk symbol “*” is a wildcard, which means that match any number of characters before or after the specified text or character.
4) This formula is case insensitive, which means it will match upper case, lower case, and mixed case text all the same.

Related functions

Excel COUNTIF function
The Excel COUNTIF function is used to count the number of cells that meet a criterion.


Related formulas

Count Blank/Nonblank Cells
This article explains formulas to count the number of blank and nonblank cells in a range in Excel.

Count cells that contain either x or y
This tutorial is going to show you how to apply a formula based on the SUMPRODUCT function in details to count the number of cells in a specific range that contain either x or y in Excel.

Count cells that contain specific text with case sensitive
This tutorial provides a formula in details to count the number of cells that contains specific text with case sensitive in a range in Excel.

Count how many cells contain errors
This tutorial shows how to count the number of cells that contains errors (any kind of errors, such as #N/A error, #VALUE! error or #DIV/0! error) in a specified range in Excel.


The Best Office Productivity Tools

Kutools for Excel - Helps You To Stand Out From Crowd

Would you like to complete your daily work quickly and perfectly? Kutools for Excel brings 300 powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) and save 80% time for you.

  • Designed for 1500 work scenarios, helps you solve 80% Excel problems.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands.
  • Become an Excel expert in 3 minutes. No longer need to remember any painful formulas and VBA codes.
  • 30-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years.
Ribbon of Excel (with Kutools for Excel installed)

Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)

  • One second to switch between dozens of open documents!
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Firefox, And New Internet Explorer.
Screen Shot of Excel (with Office Tab installed)
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations