Substitute comma-separated text in one cell with values from an array

epmd

New Member
Joined
Jul 20, 2021
Messages
8
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello all,

Here is what I am trying to do:

INCI.jpg


I want to convert the comma-separated names in column A to their common ingredient names with the output in Column B, still comma-separated. I would have a chart in another tab (screenshot below) that lists each latin name in column A and its common name in column B. However, if the one of the values in the string in column A isn't found in the chart below (for example, Parfum), it would just return that value in the string in column B. How would this be accomplished? Please note that I would have about 200 rows in the original file to be converted from Latin to common name.

1640787076220.png
 

Attachments

  • 1640786665644.png
    1640786665644.png
    69.1 KB · Views: 12
  • 1640787067097.png
    1640787067097.png
    91.2 KB · Views: 13

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
It would be much easier for people to try and help if you posted the data using XL2BB rather than as a picture. Also, if it needs to work on 2016 as well as 365, it will be more complicated, unless Power Query is an option?
 
Upvote 0
It would be much easier for people to try and help if you posted the data using XL2BB rather than as a picture. Also, if it needs to work on 2016 as well as 365, it will be more complicated, unless Power Query is an option?
Sorry, thanks, I will get XL2BB installed and repost. Power Query might be an option if it will make the process simpler. I'm using Excel 365, so I'm fine with it just working on this version.
 
Upvote 0
Here is what I am trying to do:

INCITerms.xlsx
AB
1Latin ingredient nameCommon Name
2Ricinus Communis Seed Oil, Parfum, Butyrospermum Parkii Butter, Glycine Soja Oil, Simmondsia Chinensis (Jojoba) Seed Oil, TocopherolCastor Oil, Parfum, Shea Butter, Soybean Oil, Jojoba Oil, Vitamin E
Sheet1


I want to convert the comma-separated names in column A to their common ingredient names with the output in Column B, still comma-separated. I would have a chart in another tab (screenshot below) that lists each latin name in column A and its common name in column B. However, if the one of the values in the string in column A isn't found in the chart below (for example, Parfum), it would just return that value in the string in column B. How would this be accomplished? Please note that I would have about 200 rows in the original file to be converted from Latin to common name.

INCITerms.xlsx
AB
1INCI TermCommon Name
208Macadamia Ternifolia (Macadamia Nut) Seed OilMacadamia Nut Oil
218Melaleuca Alternifolia (Tea Tree) Leaf OilTea Tree Essential Oil
219Melaleuca Leucadendron Cajaputi (Cajeput) Leaf OilCajeput Essential Oil
220Melia Azadirachta (Neem) Seed OilNeem Oil
221Melissa Officinalis (Balm Mint) Leaf OilMelissa Essential Oil
223Mentha Arvensis (Cornmint) OilCornmint Essential Oil
224Mentha Piperia (Peppermint) OilPeppermint Essential Oil - Natural
225Mentha Piperia (Peppermint) OilPeppermint Essential Oil - Redistilled
228Mentha Spicata (Spearmint) Leaf OilSpearmint Essential Oil
231Monarda Fistulosa Menthaefolia OilMonarda Essential Oil
Table 1
 
Upvote 0
How about
Excel Formula:
=LET(ary,FILTERXML("<k><m>"&SUBSTITUTE(A2,", ","</m><m>")&"</m></k>","//m"),TEXTJOIN(", ",,IFNA(XLOOKUP(ary,'Table 1'!$A$2:$A$232,'Table 1'!$B$2:$B$232,,0),ary)))
 
Upvote 0
Solution
How about
Excel Formula:
=LET(ary,FILTERXML("<k><m>"&SUBSTITUTE(A2,", ","</m><m>")&"</m></k>","//m"),TEXTJOIN(", ",,IFNA(XLOOKUP(ary,'Table 1'!$A$2:$A$232,'Table 1'!$B$2:$B$232,,0),ary)))
Awesome! Thank you, that worked perfectly.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,559
Members
449,089
Latest member
Motoracer88

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