Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count using VB

How can I write a macro to count a series of text?
example x,y,z = 3

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Count using VB

Hi
not quite sure but maybe
sub foo()
dim svalue as string
dim counter
svalue = "x,y,z"
counter = len(svalue) - len(replace(svalue,",","")) +1
msgbox counter
end sub

--
Regards
Frank Kabel
Frankfurt, Germany

"vedrah " schrieb im
Newsbeitrag ...
How can I write a macro to count a series of text?
example x,y,z = 3?


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Count using VB

or maybe

Msgbox worksheetfunction.counta(Range("A1:H1"))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Frank Kabel" wrote in message
...
Hi
not quite sure but maybe
sub foo()
dim svalue as string
dim counter
svalue = "x,y,z"
counter = len(svalue) - len(replace(svalue,",","")) +1
msgbox counter
end sub

--
Regards
Frank Kabel
Frankfurt, Germany

"vedrah " schrieb im
Newsbeitrag ...
How can I write a macro to count a series of text?
example x,y,z = 3?


---
Message posted from http://www.ExcelForum.com/




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count using VB

thanks.

but it gets more complicated...
I have a series of text many x's , many y's and many z's.
So how do I count only the x's, y's and z's?

help......

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Count using VB

Hi
you may first explain how you have stored these values?
- different cells
- in a single cell separated by comas

--
Regards
Frank Kabel
Frankfurt, Germany

"vedrah " schrieb im
Newsbeitrag ...
thanks.

but it gets more complicated...
I have a series of text many x's , many y's and many z's.
So how do I count only the x's, y's and z's?

help.......


---
Message posted from http://www.ExcelForum.com/




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count using VB

Hi Frank,

The data is arranged as follows:

x a
x b
x c
x d
y e
y f
y g
z h
z i
z j
z k
z l


how do i count items in column A.

hope u can help.

vedra

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Count using VB

Hi
msgbox application.worksheetfunction.countif(Range("A1:A1 00"),"x")

--
Regards
Frank Kabel
Frankfurt, Germany

"vedrah " schrieb im
Newsbeitrag ...
Hi Frank,

The data is arranged as follows:

x a
x b
x c
x d
y e
y f
y g
z h
z i
z j
z k
z l


how do i count items in column A.

hope u can help.

vedrah


---
Message posted from http://www.ExcelForum.com/


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
Multiple Criteria, Count If, Sum Product to get count across range Jonathan Excel Worksheet Functions 5 January 9th 08 11:32 PM
Count Employee Work Time - Don't Double-count Overlapping Apts. J Excel Worksheet Functions 0 April 27th 07 05:52 AM
Excel 2000, count, sort a list & count totals? sunslight Excel Worksheet Functions 1 April 9th 07 05:46 PM
Count Intervals of 2 Numeric values in same Row and Return Count across Row Sam via OfficeKB.com Excel Worksheet Functions 12 September 24th 05 10:58 PM
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Excel Worksheet Functions 9 July 31st 05 03:37 AM


All times are GMT +1. The time now is 10:25 PM.

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"