Conditionally Parsing Values from a Multi-select Cell

Michael Reis
Michael Reis ✭✭
edited 06/21/23 in Formulas and Functions

Hi!

I am trying to create a column formula that pulls only multi-select values which contain the string "ML" from a multi-select column.


Here is example output that I am looking for:

In this case, "Templates Used" contains the full list, while "Mini Lesson Templates" should only include values from "Templates Used" which contain the string "ML"


Appreciate your assistance in advance!

Answers

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    The only way to do this would be to parse every option out and then use a JOIN/COLLECT combo to bring back the options you want to keep. There are a number of parsing solutions already out here in the Community.

    Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!

    CERTIFIED SMARTSHEET PLATINUM PARTNER

    10xViz.com

  • Hi @Paul Newcome, I researched the topic for a couple of hours prior to posting the question and was unfortunately unable to find a solution that worked for me. My understanding of the COLLECT formula may be flawed, however.


    The way I tried to solve the issue was to have a column formula as follows:

    =JOIN(COLLECT([Templates Used]@row, [Templates Used]@row, CONTAINS("ML", [Templates Used]@row)), CHAR(10))


    However, this implementation of collect seems to treat the multi-select cell values as one cell value.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    edited 06/22/23

    The below discussion has some options for parsing out multiple selections from one cell into their own cells. In your case, you already have a delimiter established by using the multi-select column type (which is CHAR(10) = line break), so you will want to use the SUBSTITUTE method.


    From there you would use the JOIN/COLLECT combo on all of the cells containing the individually parsed options.



    Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!

    CERTIFIED SMARTSHEET PLATINUM PARTNER

    10xViz.com

  • Hi @Paul Newcome,

    I'm not sure if I am misunderstanding how to implement the formula you suggested, but using the following formula:

    =MID([Templates Used]@row, FIND("ML_", SUBSTITUTE([Templates Used]@row, CHAR(10), "ML_", 1)) + 1, FIND("ML_", SUBSTITUTE([Templates Used]@row, CHAR(10), "ML_", 2)) - (FIND("ML_", SUBSTITUTE([Templates Used]@row, CHAR(10), "ML_", 1))))

    results in a single multi-select value "m"


    Applying a JOIN(COLLECT()) as such results in the same:

    =JOIN(COLLECT(MID([Templates Used]@row, FIND("ML_", SUBSTITUTE([Templates Used]@row, CHAR(10), "ML_", 1)) + 1, FIND("ML_", SUBSTITUTE([Templates Used]@row, CHAR(10), "ML_", 2)) - (FIND("ML_", SUBSTITUTE([Templates Used]@row, CHAR(10), "ML_", 1)))), [Templates Used]@row, <>""), CHAR(10))

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    For parsing you would not use "ML_" as a delimiter. As indicated in the linked post, you have to use something that is not found in the string.


    For joining, you would not use any MID or SUBSTITUTE functions. You would use a JOIN/COLLECT that pulls together all of the helper cells that have the options individually parsed out. This goes in a separate column from those that contain the parsed data.

    Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!

    CERTIFIED SMARTSHEET PLATINUM PARTNER

    10xViz.com

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!