In this article, we will learn how to count values which end with certain text in Excel. We will try to get the count of values that end with a given sub-string. This will require the use wildcards operators of Excel.
How to solve the problem ?
For this article we will be required to use the COUNTIF function. Here we are given some values in a range and specific text value as criteria. We need to count the values where the text in cell includes all the values which ends with the given text or pattern.
Generic formula:
range: values given in as range
* : wildcards which find any number of characters within a given cell.
Pattern : given text or pattern to look for. Use patterns directly in the formula or else if you are using cell reference for the pattern use the other formula shown below.
Generic formula:
& : operator to concatenate the 2 values
Example:
All of these might be confusing to understand. So, let's test this formula via running it on the example shown below.
Here we have the ID records and we need to find the IDs which ends with A category.
Here to find the A category IDs, will be using the * (asterisk) wildcard in the formula. * (asterisk) wildcard finds any number of characters within lookup value.
Use the formula:
OR
Explanation:
Here the range is given as an array reference and pattern is given as cell reference. Press Enter to get the count.
As you can see the total values which ends with value A comes out to be 4.
Now copy the formula in other cells using the drag down option or using the shortcut key Ctrl + D as shown below.
As you can see all the different category counts of IDs is there.
You can check which values end with a specific pattern in range using the excel filter option. Apply the filter to the ID header and click the arrow button which appears. Follow the steps as shown below.
Steps:
As you can see in the above gif all the 4 values which match the given pattern. This also means the formula works fine to get the count of these values
Hope this article about how to Count values which end with using wildcards in Excel is explanatory. Find more articles on COUNTIFS functions here.
If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook. We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at info@exceltip.com
Related Articles
How to use the SUMPRODUCT function in Excel: Returns the SUM after multiplication of values in multiple arrays in excel.
COUNTIFS with Dynamic Criteria Range : Count cells dependent on other cell values in Excel.
COUNTIFS Two Criteria Match : Count cells matching two different criteria on list in excel.
COUNTIFS With OR For Multiple Criteria : Count cells having multiple criteria match using the OR function.
The COUNTIFS Function in Excel : Count cells dependent on other cell values.
How to Use Countif in VBA in Microsoft Excel : Count cells using Visual Basic for Applications code.
How to use wildcards in excel : Count cells matching phrases using the wildcards in excel
Popular Articles
50 Excel Shortcut to Increase Your Productivity
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.