Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Split a text into 50-character long strings and a break line


Dear All,


I have description text that comes in a field. I need to split the text into lines. Each line cannot be more than 50 character long. And each line must finish with a breakline character. 

the difficulty is that a word cannot be broken, i.e if the 50th character is in the middle of a word, then the line should be broken before. 

and last but not least, the description should remain in one single field. 

I have attached an example. In column A the text comes with no beak lines. In column 2 there is a beakline after the word that is closest to the 50 character. 

I hope I am clear enough. 

thank you for you help


Alteryx Certified Partner
Alteryx Certified Partner

Hi @msantoso, this is an interesting problem!


I believe I have got a solution which I have attached.


Essentially I have parsed out each word into an indivdual line, then calculated the length of the word before doing a running total.


I have then used the floor function to acknowledge if each word should be on the 1st, 2nd, 3rd, etc. lines, before using the summerize tool to bring the strings back together.






hi Ben, 

thanks a lot for your help. 


this is exactly doing what I needed. 

however, when I saved the output into a csv file, and opened it with Excel,  the text did not come into one single cell. 

Shouldn't we have a breakline after the last word of each subline? 


thank you


Alteryx Partner

That also might be how Excel processes CSV files.  I'd recommend saving to XLS format and opening in Excel, or saving as CSV and opening in Notepad (or another text editor of your choice)


Here is my solution for your case.   Steps for formatting excel output as below.  Hope this is helpful. 


1.Open the excel output

2.Press Ctrl+A to select the output text. 

3.Click Home > Format > AutoFit Column Width

4.Click Home>Wrap Text to get the desired output. 

workflow.PNGWorkflowResults.PNGResultExcel output.PNGExcel output


Hi Ponraj,


thank you so much for the solution!! 

One more thing I learned today

and one topic that I can close for today!


Have a nice day