ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count Cells containing Text only (https://www.excelbanter.com/excel-programming/280562-count-cells-containing-text-only.html)

Soniya[_2_]

Count Cells containing Text only
 
Hi all,
How can I count cells containing Text only?

TIA
Soniya

Nick Hodge[_4_]

Count Cells containing Text only
 
Soniya

the code below will count the cells with constants. (Not formulas, blank,
etc) in a selection

Sub CountConstants()
Dim lConstantCount As Long
lConstantCount = Selection.SpecialCells(xlCellTypeConstants).Count
MsgBox "There are " & lConstantCount & " Cells with constants in the
selection"
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Soniya" wrote in message
...
Hi all,
How can I count cells containing Text only?

TIA
Soniya




JMay

Count Cells containing Text only
 
With your data in A1:A100
In B1 enter:
=--ISTEXT(A1) and copy down
Then Sum(B1:B100)

"Soniya" wrote in message
...
Hi all,
How can I count cells containing Text only?

TIA
Soniya




JMay

Count Cells containing Text only
 
Perhaps you are looking for a programming answer and not a function answer,
anyway this single **Array-entered** formula is better. Use Ctrl+Shift+Enter
after
keying or pasting in:

=SUM(ISTEXT(A1:A100)*ISTEXT(A1:A100))

HTH

"JMay" wrote in message
news:oGrmb.101435$AH4.53542@lakeread06...
With your data in A1:A100
In B1 enter:
=--ISTEXT(A1) and copy down
Then Sum(B1:B100)

"Soniya" wrote in message
...
Hi all,
How can I count cells containing Text only?

TIA
Soniya






Tom Ogilvy

Count Cells containing Text only
 
Nick, think you meant to include the second argument as well:

Sub CountConstants()
Dim lConstantCount As Long
On Error Resume Next
lConstantCount = Selection.SpecialCells( _
xlCellTypeConstants,xlTextValues).Count
On Error goto 0
MsgBox "There are " & lConstantCount _
& " Cells with constants in the
selection"
End Sub

Just in case there are constant numbers in the selection as well.

--
Regards,
Tom Ogilvy


Nick Hodge wrote in message
...
Soniya

the code below will count the cells with constants. (Not formulas, blank,
etc) in a selection

Sub CountConstants()
Dim lConstantCount As Long
lConstantCount = Selection.SpecialCells(xlCellTypeConstants).Count
MsgBox "There are " & lConstantCount & " Cells with constants in the
selection"
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Soniya" wrote in message
...
Hi all,
How can I count cells containing Text only?

TIA
Soniya







All times are GMT +1. The time now is 04:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com