Home > Enterprise >  How to Split a String Up into Individual Characters
How to Split a String Up into Individual Characters

Time:09-26

Using array formula, how to divide each character into a cell.

Input   Output                                              
cat     c   a   t                                       
dog     d   o   g                                       
horse   h   o   r   s   e                               
tiger   t   i   g   e   r                               

CodePudding user response:

i think this can be done with a simple MID() formula.

=ARRAYFORMULA(MID(A2:A,SEQUENCE(1,MAX(LEN(A2:A))),1))

enter image description here

CodePudding user response:

Use this formula

Just change the range A2:A with your own.

=ArrayFormula(LAMBDA(range, delimiter,
 IF(range="",,SPLIT(REGEXREPLACE(REGEXREPLACE(range&"","(?s)(.{1})","$1"&delimiter),"'","''"),delimiter)))
 (A2:A,CHAR(127)))

enter image description here

Using the delete control character "also called DEL or rubout", with the code 127. as a dilimiter in SPLIT that joined to every charachter with REGEXREPLACE: Replace "(?s)(.{1})", with "$1"&delimiter

Used formulas help
ARRAYFORMULA - LAMBDA - IF - SPLIT - REGEXREPLACE - CHAR

CodePudding user response:

In regex, \B is not a word boundary. It matches in between strings. Use

=ARRAYFORMULA(SPLIT(REGEXREPLACE("cat","\B","           
  • Related