Home > OS >  google sheets count array elements
google sheets count array elements

Time:02-03

Hi is there a way to count elements in array like that (im using google sheets)

enter image description here

I tried googling but didnt find anyone having the same problem

CodePudding user response:

=counta(split(cellref,",")) will count the number of elements in the array (where cellref is location of your array to be split).

CodePudding user response:

You can use the SPLIT function in Google Sheets to split the cell content into separate elements, and then use the LEN function to count the number of elements in the split string.

Here's the formula you would use:

=LEN(SPLIT(A1; ",")) 1

or like this (depending on locale)

=LEN(SPLIT(A1, ",")) 1

CodePudding user response:

try:

=LEN(REGEXREPLACE(A1; "[^,]"; )) 1

enter image description here

for array:

=INDEX(IF(A1:A="";;LEN(REGEXREPLACE(A1:A; "[^,]"; )) 1))
  • Related