How to count the number of occurrences of a character in Excel
Counting the number of occurrences of a character in Excel is a trick that requires you to use a combination of two different functions. To know how to combine this function, please follow the following article of TipsMake.com us.
1. How to count the number of occurrences of a character in an Excel data cell
Excel does not have a function that can directly count the number of characters in a data cell. To do this we need to use a combination of the LEN and SUBSTITUTE functions .
1.1 Overview of LEN and SUBSTITUTE functions
The LEN function is an Excel function that counts the number of characters in a parameter cell. Assuming the parameter cell A1 has the characters "123456", then when we use the formula = LEN (A1), we will produce a result of 6 because in A1 contains all 6 characters. Note that LEN will count all characters including special characters or spaces.
The SUBSTITUTE function is an alternative function. When using this function for a data cell, it gives you the ability to replace a specific character in a data cell with another character. In addition, we can use SUBSTITUTE to delete specific characters in the data series by leaving blank characters to be replaced.
1.2 Combining LEN and SUBSTITUTE functions
We have the LEN function that calculates the number of characters in a string and the SUBSTITUTE function can remove certain characters from the string. From there we can do a simple aggregation.
First we use the LEN function to calculate the number of characters in the original string. Then we use the SUBSTITUTE function to delete the characters we are counting and then continue to use the LEN function to calculate the number of characters in the deleted string.
From there we have two numbers as the original sum along with the sum of the strings that deleted the character. Subtracting the first from the first will calculate the number of occurrences of a character in the original string.
The formula combined here is: = LEN (original string) -LEN (SUBTITUTE (original string; "character to count"; "")
Let's take a look at the example below when using the above formula to find the number of occurrences of a character in Excel.
We want to find the number of occurrences of the letter n in the original character box "Multiplication of the primitive nature". From there the formula is as follows: = LEN (A2) -LEN (SUBSTITUTE (A2; B2; ""))
Press Enter to see results.
You can then copy that formula down so you can count the special characters of the example lines below.
2. How to count the number of occurrences of a character in an Excel data array
In Part 1 we learned how to combine the LEND and SUBSSTITUTE functions to count the number of occurrences of a character in a data cell.
But if you want to count the number of characters that appear in an array of rows and columns, then we have to use another formula: = SUMPRODUCT (LEN (data array) -LEN (SUBSTITUTE (data array; characters to count; "")))
This formula is similar to the formula in Part 1, but you need to change the data cell to the parameter array data to consider. And use the SUMPRODUCT function to cover all the differences of the two LEN functions .
Based on that as the following example, let's count the number of occurrences of the letter "a" in the data array from A1 to C3. We have the formula: = SUMPRODUCT (LEN (A1: C3) -LEN (SUBSTITUTE (A1: C3; "a"; ""))))
When Enter lets Excel perform the calculation, you will see that the result is that there are 8 times the "a" appears in the data array.
Thank you for reading our article TipsMake.com on how to count the number of occurrences of a character in Excel. Wish you can do it successfully !!!
You should read it
- How to count characters in Excel
- How to Count Characters in Excel on PC or Mac
- MID and MIDB functions to cut strings in Excel
- How to use the COUNT function in Excel
- How to calculate and color blank cells in Excel
- Steps to fix Word Count not showing up in Microsoft Word
- FREQUENCY function - Function that calculates and returns the frequency of occurrences of values in a range in Excel
- COUNT function in SQL Server
May be interested
- COUNT function in SQL Serverthis article will show you in detail how to use functions that handle count () numbers in sql server with specific syntax and examples to better visualize and capture functions.
- How to use the LEN function in Excelthe len function in excel is used to measure the length of a certain string of characters, including spaces and correctly return the total character for the user.
- The COUNTA function, how to use the function to count cells containing data in Excelthe counta function in excel counts the number of cells containing data, non-empty cells in excel.
- The COUNTIFS function, how to use the cell count function according to multiple events in Excelthe countifs function in excel to count cells satisfies many given conditions.
- Excel counting functions: Count and Countifthe regular processing of data calculations with excel spreadsheets, there will be a lot when you need to use the counting function. count and countif are the 2 most basic counting functions, easy to use but for those who are new to excel, you may not know how to use it.
- DCOUNTA function, how to use the function to count non-empty cells in Exceldcounta functions in excel to count non-empty cells in database fields or lists according to specific conditions.
- Count the number of characters in the paragraphthis is a quick, accurate way to count characters in word text.
- COUNTBLANK function - Count the number of blank (empty) cells in a selected range or array in Excelthe countblank () function helps to count the number of blank (empty) cells in a selected range or array in excel.
- Have you ever wondered why we count to 3?have you ever wondered why we count to 3? let's find out in the article below!
- Summary of functions that handle character strings in Excel, syntax and examplessummary of functions that process character strings in excel, syntax and examples will help you supplement important knowledge and commands with this powerful calculation tool. character string processing functions will help you extract characters anywhere in the text content.