I have a simple Google spreadsheet with a number of text strings. I just want the number of words contained in each cell. Is there an in-built Google spreadsheet function I may use?
In Google Spreadsheets, I would do it a bit different.
=COUNTA(SPLIT(A1, " "))
SPLIT function is only available in Google Spreadsheet and will split the cell's content on every space (
" "). The
COUNT function will simply count the instances.
The Excel formula gives the same answer, but a bit more laborious:
See following answer on which formulae are unique to Google Spreadsheet:
Slight improvement to formula in this other answer so in case that A1 is blank or if it has an empty string it will return zero.
MMULT(IF(IFERROR(SPLIT(IF(LEN(A3:A), A3:A, ), " "))<>"", 1, 0),
QUERY(IF(IFERROR(SPLIT(IF(LEN(A3:A), A3:A, ), " "))<>"", 1, 0), "limit 1", 0)))))^0), ))
=ARRAYFORMULA(IF(LEN(A3:A), LEN(REGEXREPLACE(A3:A, "[^\s]", ))+1, ))