Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 989
Default number of spaces...

Hello.

I know someone showed me this before, but I've forgotten.

If I wanted to do a count of the number of spaces within a single cell, how
could I do that?

For instance, if I wanted to look at a cell that contained 'A B C D', and
get the answer that there are three spaces in that.

Thanks.
Mark
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default number of spaces...

=LEN(A1)-LEN(SUBSTITUTE(A1," ",""))
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"mark" wrote in message
...
Hello.

I know someone showed me this before, but I've forgotten.

If I wanted to do a count of the number of spaces within a single cell,
how
could I do that?

For instance, if I wanted to look at a cell that contained 'A B C D', and
get the answer that there are three spaces in that.

Thanks.
Mark



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default number of spaces...

=(len(a1)-len(substitute(a1," ","")))/len(" ")

Since you're only counting a single character, you could eliminate the
denominator:

=len(a1)-len(substitute(a1," ",""))



mark wrote:

Hello.

I know someone showed me this before, but I've forgotten.

If I wanted to do a count of the number of spaces within a single cell, how
could I do that?

For instance, if I wanted to look at a cell that contained 'A B C D', and
get the answer that there are three spaces in that.

Thanks.
Mark


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pulling Data off Web - Need Function Help patfergie44 Excel Worksheet Functions 9 June 22nd 06 03:27 AM
vlookup with more than number to be retrieved martelie Excel Worksheet Functions 1 October 8th 05 07:33 AM
Count Number of Characters in a cell? AHJuncti Excel Discussion (Misc queries) 2 June 16th 05 07:39 PM
Need number of Saturdays and number of Sundays between 2 dates Class316 Excel Worksheet Functions 1 June 10th 05 02:47 AM
how do I remove empty spaces trailing a text string? Need_Help Excel Worksheet Functions 2 June 7th 05 12:13 AM


All times are GMT +1. The time now is 07:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"