Thanks all.
Formula works but counts one less, so i am adding one manually.
Regards,
Kaushik
---
Hi,
=LEN(A1)-LEN(SUBSTITUTE(A1," ",""))
Regards.
Daniel
De : excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] De
la part de KAUSHIK SAVLA
Envoyé : mardi 26 juillet 2011 06:07
À : excel-macros@googlegroups.com
Objet : $$Excel-Macros$$ Help Required (Excel Function or
Dear Kaushik,
In Excel
Try it
*=LEN(SUBSTITUTE(B2," ",""))*
in VBA...
Try it.
*Function cell_length(s as range)*
*cell_length=application.worksheetfunction.*
*Function cell_length(s As Range)
cell_length = Len(Application.WorksheetFunction.Substitute(s, " ", "")
Try this
=LEN(B1)-LEN(SUBSTITUTE(B1," ",""))
From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of KAUSHIK SAVLA
Sent: Tuesday, July 26, 2011 9:37 AM
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ Help Required (Excel Function or VBA Code)
Hi,
Use this formula
=LEN(A1)-LEN(SUBSTITUTE(A1," ",""))
where A1 contains "9 7 5 6"
On Tue, Jul 26, 2011 at 9:36 AM, KAUSHIK SAVLA wrote:
> Hi All,
>
> I want to count the number of spaces in a cell:-
> Eg In Cell A1 data is "9 7 5 6" I want function which returns answer as 4
> count.
>
>