H
Harlan Grove
Ron Rosenfeld wrote...
....
An alternative would be to prevent the error. One option, which
excludes empty fields and returns 0 for blank cells or cells evaluating
to "",
=COUNTDIFF(EVAL("{"""&SUBSTITUTE(A1,",",""",""")&"""}"),,"")
And an alternative regex formula would be
=COUNTDIFF(REGEX.MID(A1&",","[^,]+",INTVECTOR(REGEX.COUNT(A1&",,",","),1)),,"")
But maybe the direct approach makes more sense.
=IF(WORDCOUNT(A1,","),COUNTDIFF(REGEX.MID(A1,"[^,]+",
INTVECTOR(WORDCOUNT(A1,","),1))),0)
....
....To correct that problem, we will exclude the #VALUE! error from being counted:
=COUNTDIFF(ARRAY.JOIN(REGEX.MID(A1,"[^,]+",
INTVECTOR(REGEX.COUNT(A1,"[^,]+"),1))),,#VALUE!)
An alternative would be to prevent the error. One option, which
excludes empty fields and returns 0 for blank cells or cells evaluating
to "",
=COUNTDIFF(EVAL("{"""&SUBSTITUTE(A1,",",""",""")&"""}"),,"")
And an alternative regex formula would be
=COUNTDIFF(REGEX.MID(A1&",","[^,]+",INTVECTOR(REGEX.COUNT(A1&",,",","),1)),,"")
But maybe the direct approach makes more sense.
=IF(WORDCOUNT(A1,","),COUNTDIFF(REGEX.MID(A1,"[^,]+",
INTVECTOR(WORDCOUNT(A1,","),1))),0)