Expanding a cell with comma-separated values to multiple different cells

Caracarn

New Member
Joined
Jan 18, 2022
Messages
5
Office Version
  1. 2021
  2. 2011
  3. 2010
Platform
  1. Windows
Maybe I'm going about this the wrong way, but I'm trying to take a cell with comma-separated text in it and expanded it to multiple different cells in a column using formulas. I realize that I can use Data > Text to Columns, but I'd love for this to be automatic by formulas.

The whole goal of this is to be able to type in different meals into a spreadsheet under the Meal column. Then the spreadsheet will populate the ingredients from another spreadsheet (Where I have recipes already entered). Then it will take the ingredients column and expand it into one large list that would be easily printed to go shopping. I understand that this might not be the easiest way, or possible, but in my head, it sounded like a great idea.

So, is there a way to automate this process with formulas? or am I trying to do something that is impossible with formulas and I'll just have to use the Text to Columns feature. Thanks for any help that you can give me!

This is what I want to start with:
MealIngredients
PizzaPizza, Breadsticks, Chips
SandwichesBread, Tomatoes, Onions, Lettuce
Sloppy JoesMeat, Sloppy Joe, Hamburger Buns, Onions, Pickles

This is what I want to end with:
Shopping List
Pizza
Breadsticks
Chips
Bread
Tomatoes
Onions
Lettuce
Meat
Sloppy Joe
Hamburger Buns
Onions
Pickles
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Using your Excel 2021, try this

22 01 20.xlsm
ABCD
1MealIngredientsList
2PizzaPizza, Breadsticks, ChipsPizza
3SandwichesBread, Tomatoes, Onions, LettuceBreadsticks
4Sloppy JoesMeat, Sloppy Joe, Hamburger Buns, Onions, PicklesChips
5Bread
6Tomatoes
7Onions
8Lettuce
9Meat
10Sloppy Joe
11Hamburger Buns
12Onions
13Pickles
14
List
Cell Formulas
RangeFormula
D2:D13D2=FILTERXML("<p><c>"&SUBSTITUTE(TEXTJOIN(",",1,B2:B10),",","</c><c>")&"</c></p>","//c")
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,216,419
Messages
6,130,515
Members
449,585
Latest member
kennysmith1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top