Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default How do you count the number of * in a string?

Hi all,

Could anybody provide the vba code to count the number of * contained
in the string of a cell. The string has leading 'spaces'

TIA

Regards

Michale
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default How do you count the number of * in a string?

On Jan 14, 1:22*pm, "michael.beckinsale"
wrote:
Hi all,

Could anybody provide the vba code to count the number of * contained
in the string of a cell. The string has leading 'spaces'

TIA

Regards

Michale


If the string is in C1

occursnumber = Len(Range("C1")) - Len(Replace(Range("C1"), "*", ""))

Regards,
Stefi
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default How do you count the number of * in a string?

Hi Stef,

Thanks very much, works like a dream.

I would never thought of doing that way!

Regards

Michael

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default How do you count the number of * in a string?

You are welcome! Thanks for the feedback!
Clicking the YES button will be appreciated.
Stefi

€˛michael.beckinsale€¯ ezt Ć*rta:

Hi Stef,

Thanks very much, works like a dream.

I would never thought of doing that way!

Regards

Michael

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default How do you count the number of * in a string?

Another way to count the asterisks (just so you can see that VB is rich with possibilities) is this...

NumberOfAsterisk = UBound(Split(Range("C1"), "*"))

--
Rick (MVP - Excel)


"michael.beckinsale" wrote in message ...
Hi Stef,

Thanks very much, works like a dream.

I would never thought of doing that way!

Regards

Michael



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default How do you count the number of * in a string?

On Jan 14, 6:02*pm, "Rick Rothstein"
wrote:
Another way to count the asterisks (just so you can see that VB is rich with possibilities) is this...

NumberOfAsterisk = UBound(Split(Range("C1"), "*"))

--
Rick (MVP - Excel)



"michael.beckinsale" wrote in ...
Hi Stef,


Thanks very much, works like a dream.


I would never thought of doing that way!


Regards


Michael- Hide quoted text -


- Show quoted text -


That's really tricky!
Stefi
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
Count Consecutive string of same number andy Excel Worksheet Functions 6 December 29th 09 03:48 AM
Count based on single number in string Basenji Excel Worksheet Functions 7 July 14th 09 04:46 PM
How to count the number of occurrence within string? Eric Excel Discussion (Misc queries) 2 October 12th 08 08:56 AM
count number of letters in a string Wiley Excel Worksheet Functions 3 May 11th 06 06:54 PM
count number of occurences within a string Gabriel Excel Worksheet Functions 2 November 25th 04 04:17 PM


All times are GMT +1. The time now is 12:31 AM.

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

About Us

"It's about Microsoft Excel"