#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Count A's

is there a VBA statement that can return the number of times the letter A
appears in a range named ("Letters"). this range contains only single letter
values, A, G, M, I, P, and R. i want to count how many A's there are in this
range. TIA.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Count A's


"Spencer Hutton" wrote in message
...
is there a VBA statement that can return the number of times the letter A
appears in a range named ("Letters"). this range contains only single
letter
values, A, G, M, I, P, and R. i want to count how many A's there are in
this
range. TIA.


In VBA, if in fact each cell in the range only contains a single letter, you
could do this:

Dim cell as range
Dim a as Long

For Each cell in Range("Letters").Cells
If cell.Value = "A" Then
a = a + 1
End If
Next cell


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


cNum = Application.Countif(Range("Letters"),"A")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Spencer Hutton" wrote in message
...
is there a VBA statement that can return the number of times the letter A
appears in a range named ("Letters"). this range contains only single

letter
values, A, G, M, I, P, and R. i want to count how many A's there are in

this
range. TIA.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default Count A's

To count the cells in a range that have a specific letter (or any particular
value) then try the COUNTIF() function. Something like COUNTIF(A1:A10,"A")
will count the number of cells in the range from A1 to A10 that have a value
of "A".

If you want to count the number of times a specific character occurs in a
single cell try something like: LEN(A1)-LEN(SUBSTITUTE(A1,"a","")) which will
return the total number of times the letter "a" occurs in cell A1.

Hope that helps.

TK

"Spencer Hutton" wrote:

is there a VBA statement that can return the number of times the letter A
appears in a range named ("Letters"). this range contains only single letter
values, A, G, M, I, P, and R. i want to count how many A's there are in this
range. TIA.

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 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
How do i count numbers and letters to find a total count of all Linda Excel Worksheet Functions 4 November 10th 05 04:51 PM
Count Intervals of 1 Numeric value in a Row and Return Count down Column Sam via OfficeKB.com Excel Worksheet Functions 8 October 4th 05 04:37 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 11:43 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"