I am trying to create a custom function that would allow me to select a range and return the number of cells that contain strings within that range.
Example: If I select a range of 8 Cells containing the following list, it would return the value 3
abc
123
10/25/2010
True
def
False
=A10-B10
ghi
It would return three because "abc" "def" and "ghi" are the only three strings within my selection.
I am lost with figuring out how to determine if the cell contains a string. Any ideas?
Without having a sample to see the values in question... you might find:
will give you the desired result=COUNTIF(A1:A8,"?*")
(the ? itself is not nec. required depends on whether formula nulls should be treated as text or not - remove ? if they should be included)
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Thanks a lot! I was able to create a custom function using your help.
Public Function StringCount(myRange As Range) As Integer
StringCount = Application.WorksheetFunction.CountIf(myRange, "?*")
End Function
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks