Google-sheets – How to use the SPLIT function to separate unseparated characters in Google Sheets

googlegoogle sheets

I have tried the function SPLIT with the argument "" and it does not work.

I have a list that is phylogenetic code, so in the source file it's structured like: 10??12103??? etc., and I want to insert it into a Google sheet and split it to line up with some precoded materials for other taxa.

Best Answer

SPLIT will work:

=SPLIT(A2,"?",0,1)

Here, SPLIT views the split character (i.e, "?") as the same whether there is 1, or whether there are 500 of them in a row.

Of course, this can be applied to an entire column as well:

=ArrayFormula(IF(A2:A="","",SPLIT(A2:A,"?",0,1)))

Your post shows "?" as the non-numeric characters. However, you may simply have meant that those question marks stand for any of various non-numeric characters. In that case, use this:

=SPLIT(REGEXREPLACE(A2:A,"[^0-9]","?"),"?",0,1)

...or for the whole column...

=ArrayFormula(IF(A2:A="","",SPLIT(REGEXREPLACE(A2:A,"[^0-9]","?"),"?",0,1)))