Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default Counting a range of cells with TEXT

If i have the following range, for example:

A
1 apple
2 35.5236
3 abc
4 s
5 625
6 inv

How can I program the NUMBER of cells that returns a text value...(in this
example, the answer would be 4)??

Thank you,

FLKulchar
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Counting a range of cells with TEXT

=SUMPRODUCT(--(A1:A10<""),--(NOT(ISNUMBER(A1:A10))))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"F. Lawrence Kulchar" wrote in
message ...
If i have the following range, for example:

A
1 apple
2 35.5236
3 abc
4 s
5 625
6 inv

How can I program the NUMBER of cells that returns a text value...(in this
example, the answer would be 4)??

Thank you,

FLKulchar



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Counting a range of cells with TEXT

Hi,

Why you don't use Worksheet function to this with:
=COUNTIF(A1:A6,"apple")

but if you want it programtically use:
sub countsomething()
dim j as long, v
v = 0
for j = 1 to 6
if cells(j,1).value= "apple" then v = v+1
next j
msgbox v
end sub

Regards,

halim


F. Lawrence Kulchar menuliskan:
If i have the following range, for example:

A
1 apple
2 35.5236
3 abc
4 s
5 625
6 inv

How can I program the NUMBER of cells that returns a text value...(in this
example, the answer would be 4)??

Thank you,

FLKulchar


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 266
Default Counting a range of cells with TEXT

"F. Lawrence Kulchar" skrev i
en meddelelse ...
If i have the following range, for example:

A
1 apple
2 35.5236
3 abc
4 s
5 625
6 inv

How can I program the NUMBER of cells that returns a text value...(in this
example, the answer would be 4)??

Thank you,

FLKulchar



One way:

Sub NumOfTextEntries()
'Leo Heuser, 4 Sept. 2006
Dim Cell As Range
Dim Counter As Long

For Each Cell In Worksheets("Sheet1").Range("A1:A6").Cells
If Application.IsText(Cell.Value) Then Counter = Counter + 1
Next Cell

MsgBox "Number of text entries: " & Counter
End Sub

--
Best regards
Leo Heuser

Followup to newsgroup only please.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default Counting a range of cells with TEXT

PERFECT..thank you..

I understand it perfectly, but I NEVER could have created it!

Thank you,

FLKULCHAR

"Bob Phillips" wrote:

=SUMPRODUCT(--(A1:A10<""),--(NOT(ISNUMBER(A1:A10))))

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"F. Lawrence Kulchar" wrote in
message ...
If i have the following range, for example:

A
1 apple
2 35.5236
3 abc
4 s
5 625
6 inv

How can I program the NUMBER of cells that returns a text value...(in this
example, the answer would be 4)??

Thank you,

FLKulchar




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
Counting Occurrence of Text within Text in Cells in Range. Jeremy N. Excel Worksheet Functions 1 September 8th 05 05:16 AM
Counting unique text/number cells from a range sudeepd12 Excel Discussion (Misc queries) 3 June 15th 05 07:58 PM
Counting unique text/number cells from a range sudeepd12 Excel Programming 1 June 15th 05 12:01 AM
Counting unique text/number cells from a range sudeepd12 Excel Worksheet Functions 2 June 14th 05 11:21 PM
counting cells in a range Charles Excel Discussion (Misc queries) 5 February 18th 05 11:59 PM


All times are GMT +1. The time now is 08:27 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"