
The SUBSTITUTE function is used to remove a specific word from a string. Where string can be a text or reference to a cell containing text for which you want to find the length. The syntax for the function is: =LEN( string) It is used to find the length of a string (number of characters in a string). The LEN function is a very commonly used Excel function.
How to use excel solver function for multiple cells code#
You can also use VBA code to get the job done quickly.

To solve this problem, there are a number of methods that you can use.įor example, you can use a formula that comprises a combination of Excel functions, like SUBSTITUTE and LEN. However, it does not work if you want to find the number of times a word occurs inside the string of a cell.įor example, say you have the following string in a cell (A2) and you want to know how many times the word “happy” appears: The above method works fine if you’re looking to count cells that exactly match a given word. If one of the cells, for example, had the words “Peter Peter” in one cell, the COUNTIF function would not consider it as a match, and so would not count the cell.Ĭount a Specific Word in a Cell using LEN and SUBSTITUTE Note: This method only counts the number of cells that contain exactly the word “Peter”. This will give the number of times the word “ Peter” appears in the range of cells A2:A10.


Count How many times a Word Appears in a Range.Count a Specific Word in a Cell using LEN and SUBSTITUTE.Count a Specific Word in a Range using COUNTIF.
