Search code examples
regexgoogle-sheetssplitgoogle-sheets-formulaarray-formulas

Extracting multiple lines of text between delimiters from a single cell


In Google Sheets or Excel, I would like to extract multiple lines of text between the delimiters x/ and / using a single formula.

INPUT:

x/Apple Juice/,Banana,Grape,x/Pear Juice/,Cherry,Orange,Blueberry

OUTPUT expected:

Apple Juice, Pear Juice

The input line of text may be longer or shorter and the position and instances of "x/text/" can vary.


Solution

  • =ARRAYFORMULA(TEXTJOIN(", ", 1, IFERROR(REGEXEXTRACT(SPLIT(A1, ","), "x/(.*)/"))))
    

    0