Excel allows a user to count cells that begin with certain characters, by using the COUNTIF function. This step by step tutorial will assist all levels of Excel users in counting cells in a range that begin with a specific text.
Figure 1. The result of the COUNTIF function
Syntax of the COUNTIF Formula
The generic formula for the COUNTIF function is:
The parameters of the COUNTIFS function are:
- criteria_range – a range where we want to apply our criteria
- criteria – a criteria which we want to count
Setting up Our Data for the COUNTIF Function
Figure 2. Data that we will use in the COUNTIF example
In the data table, we have 4 columns: “Delivery Number” (column B), “Delivery Date” (column C), “City” (column D) and “Amount” (column E). In the cell H2, we have a criteria for the function, while in H3 we want to get a result.
Count Cells That Begin With a Certain Text
In our example, we want to count how many cells from the column D begin with “CA”.
The formula looks like:
The parameter criteria_range is D3:D9 and the criteria is in the cell H2. We have to put an asterisk in criteria (CA*). An asterisk stands for any character.
To apply the COUNTIF function, we need to follow these steps:
- Select cell H3 and click on it
- Insert the formula:
- Press enter
Figure 3. Counting the cells that begins with a certain text
As you can see, cells D3, D4, D8 and D9 begin with “CA”, so the result of the function in the cell H3 is 4.
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.