SOLVED

Adding a , after a group of text

Copper Contributor

Good morning, I was looking to add a ,(coma) and a space after every 4 characters.

For example,

qwerasdfzxcv ------> qwer, asdf, zxcv

not always will it always be 12 characters but will always be sets of 4 characters

 

Ive been able to just add 1 , after qwer, but no multple using 

=replace(a1,5,0,", ")

 

im sure I can probably tie in the same formula Mutiple times but have no clue how

4 Replies
best response confirmed by FatManFluff (Copper Contributor)
Solution

@FatManFluff 

 

=TEXTJOIN(", ", TRUE, MID(A1, SEQUENCE(ROUNDUP(LEN(A1)/4, 0), , , 4), 4))

this worked like a charm but just noticed that I do indeed have some charters that 5 characters and not always 4 so its mixed combination of 4 and 5 character all in random sequence. There some instances where it even has a space so then it throws everything off.

For example,

qwer asdfzxcv

 

Regardless thank you for the help and your answer was indeed correct when always a 4 character combination

@FatManFluff 

Is there a rule that determines when to use 4 or 5 characters?

Unfortunately no it’s at random so that’s y I feel like there won’t be anything I can use and sometimes the 5 characters are in the front middle or the back.
1 best response

Accepted Solutions
best response confirmed by FatManFluff (Copper Contributor)
Solution

@FatManFluff 

 

=TEXTJOIN(", ", TRUE, MID(A1, SEQUENCE(ROUNDUP(LEN(A1)/4, 0), , , 4), 4))

View solution in original post