Forum Discussion

NothingHeavy's avatar
NothingHeavy
Copper Contributor
Jul 28, 2025
Solved

Inserting delimiter every nth space in a string

Scope: Building a spreadsheet that takes Fault Tree analysis inputs in a table and then outputs everything in DOT language to visualize the information using Graphviz. User will input an Event ID, E...
  • m_tarler's avatar
    Jul 28, 2025

    I recommend adding this LAMBDA function to your Name Manager:

    =LAMBDA(inTxt,wordCount, TEXTJOIN(" ",1,DROP(TOCOL(EXPAND(WRAPROWS(TEXTSPLIT(inTxt," "),wordCount,""),,wordCount+1,"\n")),-1)))

    Then you can just call it using:

    =NewLine(A1,3)

    where A1 is the text and 3 is how many words to space it by

    line 13 inserts every 3rd word and line 14 inserts every 4th word