Formula Help to Parse a Comma Separated List of Values into Different Cells

Been trying to figure out how to parse this for a few days now. Any help would be greatly appreciated.


I have several lists that I want to be able to use as the basis for a series of cells in a column.


For example, I have three lists:

List 1: apple, orange, mango, banana, strawberry

List 2: cauliflower, broccoli, corn, potato, rice

List 3: hamburger, chicken, lamb, pork, fish


What I'd like to do is select a check box for each list, and have a column of cells reflect the values in whichever list is selected.


For example if List 1 is selected, the result would look like this:

A B C

1 apple

2 orange

3 mango

4 banana

5 strawberry


I'm just not quite sure how to get the cells to see where in the list they should "draw from".


Any suggestions or examples would be greatly appreciated.


Rich


MacBook Air 13", macOS 10.13

Posted on Feb 27, 2019 3:53 PM

Reply
2 replies

Feb 28, 2019 2:16 AM in response to Skriddo

Hi Skriddo,


Put your lists into separated cells in a second table. Here are two examples:


Upper example:

Choose a column on the second table by checking the box in the header row cell of that column.

Use the formula below on the first column:


B2: INDEX(Table 2::$A:$C,ROW(),MATCH(TRUE,Table 2::$1:$1,0))


Enter the formula as shown in B2, then fill down to B6.


As written, the formula will return errors when no box is checked. Wrap the formula in an IF statement to avoid the error flags:


B2: IF(COUNTIF(TABLE 2::::$1:$1,TRUE)<1,"",INDEX(Table 2::$A:$C,ROW(),MATCH(TRUE,Table 2::$1:$1,0))0)


Lower example:

Choose the list to be shown by typing a letter into the header box in column B of the table on the left.

The formula in this version is similar to the one in the first version.


B2: INDEX($A:$C,ROW(),MATCH(B$1,'Table 2-1'::$1:$1,0))


Note that the letter is not case sensitive.

Leaving cell B1 empty will produce a column of error flags, which van be avoided with the same type of IF statement as above.


B2: IF(LEN(B$1)<1,"",INDEX($A:$C,ROW(),MATCH(B$1,'Table 2-1'::$1:$1,0)))


Regards,

Barry



Feb 28, 2019 2:10 AM in response to Skriddo

Hi Skriddo,


This may get you started.


In Table 1, Column C adds commas to surround the original string. That makes it easier to use a single formula to find the positions of the commas and then pull out single words.



C2 =", "&B2&", " (Fill Down)

D contains 0 as a starting position.

E2 = FIND(",",$C2,D2+1) (Fill Down and Fill Right.)


Table 1-1

Formula in A2 (and Fill Down and Fill Right) =MID(Table 1::$C2,Table 1::E2+2,Table 1::F2−Table 1::E2−2)


You can transpose Table 1-1 to put the lists into columns, but I don't think that is what you want.

More work with the OFFSET function I think!

We can hide the red error triangles and hide intermediate calculation columns.


Regards,

Ian.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Formula Help to Parse a Comma Separated List of Values into Different Cells

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.