Reputation: 318
I am currently working on a Google Sheets project, and I'm facing a challenge with counting the number of words in a cell.
I have tried using the following formula:
=IF(A1="", "", COUNTA(SPLIT(A1, " ")))
Unfortunately, it doesn't seem to be working as expected, and I'm not getting the error "Formula parse error".
Sample data: https://docs.google.com/spreadsheets/d/17Zel32C06M49KkLk2YQ6HQqEP68yutF8WZsE551ZxKc/edit?usp=sharing
The objective is to count the number of words in cell A2, excluding any leading or trailing spaces. However, the formula is not providing the desired result. I have tried other formulas such as
= LEN ( A1 ) - LEN ( SUBSTITUTE ( A1, " ", "" ) ) + 1
Could someone please help me with a reliable formula or an alternative approach to accurately count the number of words?
Thank you for your help!
Upvotes: 0
Views: 599
Reputation: 10217
Just change the commas to semi-colons, according to your locale ;)
=IF(A3="";"";COUNTA(SPLIT(A3;" ")))
= LEN ( A3 ) - LEN ( SUBSTITUTE ( A3; " "; "" ) ) + 1
Upvotes: 1