Dear Readers,
Getting a word Count of a String kept in a Cell, is not so difficult but sometimes you just don’t get it how to do it. So keeping that in mind, I wrote all possible ways to get Word Count of a String. You can get it by Excel Formula as well as UDF (User Defined Function).
We will see both the methods one by one below:
1. Get Word Count by Excel Formula
=LEN(A1)-LEN(SUBSTITUTE(A1,” “,””))+1
Where:
A1: Cell Address, Where your String is there.
Note:
Here in this Formula, the limitation is that if there are more than One spaces between two words then the Spaces will also be counted as a Word and the Count will not be proper.
2. Get Word Count by User Defined Function (UDF) Macro
Put the below code in Regular Module of your Workbook.
Function GetWordCount(Cell As Range)
GetWordCount = UBound(Split(Cell.Value, " ")) + 1
End Function
Now you can use the below Formula to get the Word Count
=GetWordCount(Cell Address)
3. Get Letter Count in Excel Formula
=LEN(A1)
Where:
A1: Cell Address, Where your String is there.
Note:
This will return the total count of letters in that cell, including spaces as well.
0 Comments
Trackbacks/Pingbacks