March 4, 2010

Counting of characters in a cell excluding spaces

If you need to count the number of characters of text/string in a cell and you don’t want to count the spaces in that cell. We can count the characters alone. Please look into the below example.



In above example, we have the name “John David” in the cell A1 and we had calculated the number of characters in that name using =LEN(SUBSTITUTE(A1," ","")). This formula works in two ways 1st the SUBSTITUTE(A1,” “,””) formula, substitutes the space “ “ with a null value and it will become as JohnDavid and then we used LEN() formula to counted the number characters from the result of first one.

2 comments: