ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count Spaces In A String (https://www.excelbanter.com/excel-programming/280408-count-spaces-string.html)

Josh in Tampa

Count Spaces In A String
 
anyone know how i can count the number of spaces in a
string?

thanks.

Jim Rech

Count Spaces In A String
 
=LEN(A1)-LEN(SUBSTITUTE(A1," ",""))

--
Jim Rech
Excel MVP



Jim Rech

Count Spaces In A String
 
Or in VB:

Len(Strg) - Len(Replace(Strg, " ", ""))

--
Jim Rech
Excel MVP




All times are GMT +1. The time now is 04:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com