Nov 12, 2016 07:19 AM
Has anyone worked out how to use the COUNT function to count the number of characters in a text string?
Nov 12, 2016 02:38 PM
I think LEN
will do what you want.
COUNT
counts the numeric items passed to it, e.g. COUNT(1, "hello", 5)
returns 2.
Nov 13, 2016 09:44 AM
Got it; many thanks!
A.
Nov 17, 2016 09:10 AM
What is “LEN”?
Thank you
Nov 17, 2016 09:39 AM
LEN(string): Returns the length of a string.
Nov 17, 2016 10:28 AM
Thank you for the quick response. Useful, but it will not do what I would like to do - which is make a count of a list of states (2 letter codes) in another field.
Nov 18, 2016 07:18 AM
There are a few ways to tackle this, but they depend on where your two-letter state values are.
Are they comma-separated in one field? Or are they separate fields in one record? Or are you trying to count fields in multiple records?
In any case, Rollup might be ur solve:
Nov 18, 2016 07:57 AM
Thank you for persevering on this - it is good to check that I am not missing something which ought to be blindingly obvious! I do use roll-up for a different field and for that one it works a treat - but is not suitable for this one.
The data in the field in question is entered as space separated, 2-letter standard postal state codes in a single text field. In this particular case that is the easiest way to handle the information everywhere else I use it.
At least I learned what “LEN” stands for!
Nov 18, 2016 08:30 AM
Hmm. Not sure yet how to crack it for ya.
If you had the states in separate fields, it’s easy to use COUNTALL and then also make a CONCATENATE field that creates what you have now; multiple states in one field.
Nov 19, 2016 06:34 AM
Hi Kat
If, for example, the name of your field is “States” with string value similar to AA AB AC AD etc this formula should work for you:
IF(LEN(States) > 0, (LEN(TRIM(States)) - LEN(SUBSTITUTE(States, " “, “”))) + 1,”")
It handles empty cells, double spaces,and leading/trailing spaces
Have Fun,
Pete