Forum Discussion
manhuy
Mar 14, 2023Copper Contributor
Extract text from Comma Separated Cell to another Comma Separated Cell
 Hi Community,     I was wondering if anyone could help me with this problem.   Any method to achieve "Desired Outcome" column would be appreciated.     Data  Desired Outcome    BAR-Barcelona (1), RM-...
- Mar 14, 2023
=LET( ζ, TEXTSPLIT(A1, "-", " "), TEXTJOIN(", ", , FILTER(TAKE(ζ, , 1), 1 - ISNA(TAKE(ζ, , -1)))) ) 
SergeiBaklan
Mar 14, 2023Diamond Contributor
One more variant
=LET(
    range, $B$2:$B$5,
    MAP(
        range,
        LAMBDA(v,
            LET(
                s, TEXTSPLIT(v, {",","-"}),
                TEXTJOIN(", ", , CHOOSECOLS(s, SEQUENCE(COLUMNS(s) / 2, , 1, 2)))
            )
        )
    )
)