![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
|
Dear Most Amazing Excel Team,
If I have numbers, words, errors, blanks and True/False values in the range C2:C9, and I want the shortest (in length) and fastest (calculation time) formula for counting just words, what formula should I use? I have created this one which works: =SUM(IF(ISTEXT(C2:C9),IF(C2:C9<>"",1,0))) Entered with Ctrl = Shift + Enter Any ideas on better formulas (shorter, faster)?
__________________
Sincerely, Mike Gel Girvin |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2008
Location: London, UK
Posts: 2,159
|
Quote:
Code:
=-SUMPRODUCT(-ISTEXT(C2:C9))
__________________
Colin Microsoft MVP - Excel |
|
|
|
|
|
|
#3 |
|
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
|
Dear Colin_L,
My fault here, I forgot to say that I have formulas in the range that evaluate to blank and so the SUMPRODUCT formula would count those. I formulas like: ="" and =IF(A3=1,3,"") So the revised list of what could be in the range C2:C9 is: 1) Words / Text 2) Numbers 3) Errors 4) Blanks 5) Formulas that evaluate to blanks 6) TRUE / FALSE Thanks!
__________________
Sincerely, Mike Gel Girvin |
|
|
|
|
|
#4 |
|
Join Date: Feb 2009
Location: East Lothian.....near Edinburgh
Posts: 633
|
Colin thats fantastic........clever yet so simple!
|
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2008
Location: London, UK
Posts: 2,159
|
Maybe to allow for errors and formulas that return "", this would be an option?
Code:
=SUM((LEN(IF(ISERROR(C2:C9),"",C2:C9))>0)*ISTEXT(C2:C9))
__________________
Colin Microsoft MVP - Excel |
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 40,228
|
Try...
=COUNTIF(C2:C9,"?*") |
|
|
|
|
|
#7 |
|
MrExcel MVP
Join Date: Feb 2008
Location: London, UK
Posts: 2,159
|
__________________
Colin Microsoft MVP - Excel |
|
|
|
|
|
#8 |
|
Join Date: Dec 2005
Location: Seattle, WA
Posts: 321
|
Yes, This is the one:
=COUNTIF(C2:C9,"?*") Thanks Aladin! I am very happy to now add "?*" to my bag of Excel Tricks for the times when I want to count words when there may be blanks from formulas. Thanks everyone! This is such a great Excel Team!
__________________
Sincerely, Mike Gel Girvin |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|