<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Extract text (sub) strings from a text string using a pre-specified list in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3511512#M114792</link>
    <description>&lt;P&gt;this function will be ran in each row of your table.&lt;/P&gt;
&lt;P&gt;it firstly get the value of [Title] in this row&lt;/P&gt;
&lt;P&gt;then, test if it contains any value in the first list-item of each row in your pre-prepared list&lt;/P&gt;
&lt;P&gt;it will skip all the row of which the first list-item did not be found in Title,&lt;/P&gt;
&lt;P&gt;then get the first row of the remain pre-prepared list, and get the 2nd item of the row as the replacement.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Nov 2023 09:06:44 GMT</pubDate>
    <dc:creator>wdx223_Daniel</dc:creator>
    <dc:date>2023-11-02T09:06:44Z</dc:date>
    <item>
      <title>Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3499343#M114356</link>
      <description>&lt;P&gt;Hiya good people of PQ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a text column as containing various texts,e.g. xxyyzz, xxxabc, acdfgh.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to extract the the texts "x", "c" and "h" for example, using a pre-specified list {"x","c","h"}, if there is a match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently using if text.contains code, but its starting to get very complicated with every new data refresh adding more complexity to the text column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there was a simpler solution with List.accumulate, e..g, then I could just update the list.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and best regds.,&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 15:14:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3499343#M114356</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2023-10-26T15:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3499744#M114378</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="374430" data-lia-user-login="monojchakrab" class="lia-mention lia-mention-user"&gt;monojchakrab&lt;/a&gt;&amp;nbsp;- could you please share an example data and the Power Query code that you are currently using?&amp;nbsp; I think you might need a solution that uses List.ContainsAny. List.Select and List.FindText rather than only Text based functions.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 18:29:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3499744#M114378</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-26T18:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3500429#M114417</link>
      <description>&lt;P&gt;Hey&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a snapshot of the text column :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;And here is the code I am using for extracting the key words like Stevia or Aspartame and I use similar code to extract the pack size of type (like sachets or tablets) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table.AddColumn(Custom2, "Ingredient", each if 
Text.Contains([Title],"50%",Comparer.OrdinalIgnoreCase) or Text.Contains([Title],"sugarlo",Comparer.OrdinalIgnoreCase)then "SugarLo" else 
if Text.Contains([Title],"Stevia",Comparer.OrdinalIgnoreCase) or Text.Contains([Title],"Green",Comparer.OrdinalIgnoreCase)
then "Stevia" else 
        if Text.Contains([Title],"classic",Comparer.OrdinalIgnoreCase) or Text.Contains([Title],"cook",Comparer.OrdinalIgnoreCase) or Text.Contains([Title],"zero calorie",Comparer.OrdinalIgnoreCase) then "Sucralose" else 
        if Text.Contains([Title],"original" ,Comparer.OrdinalIgnoreCase) or Text.Contains([Title],"Low Calories", Comparer.OrdinalIgnoreCase) 
        then "Aspartame" else 
        if Text.Contains([Title],"xylitol",Comparer.OrdinalIgnoreCase) then "Xylitol" else null)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code keeps getting longer and more complex with every refresh as the texts start getting new additions everytime so I&amp;nbsp; have to mody this code post every refresh.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But what remains invariant is the list of actives or the list of pack sizes or the type etc - hence if I can work off a list, it will be a simple task just to update the relevant list&lt;/P&gt;&lt;P&gt;Thanks and appreciate the leg-up&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 04:12:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3500429#M114417</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2023-10-27T04:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3500439#M114418</link>
      <description>&lt;LI-CODE lang="cpp"&gt;Table.AddColumn(Custom2, "Ingredient", each
            List.Skip(
                      {{{"50%","sugarlo"},"SugarLo"},
                       {{"Stevia","Green"},"Stevia"},
                       {{"classic","cook","zero calorie"},"Sucralose"},
                       {{"original","Low Calories"},"Aspartame"},
                       {{"xylitol"},"Xylitol"}
                      },
                      (x)=&amp;gt;not List.ContainsAny(x{0},[Title],(x,y)=&amp;gt;Text.Contains(y,x,Comparer.OrdinalIgnoreCase))
                      ){0}?{1}?
               )&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 27 Oct 2023 04:30:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3500439#M114418</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-10-27T04:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3501077#M114447</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp;- thanks for stepping in...I will definitely try this out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But could you help me with the logic here so that I might be able to use the code in other situation also with some modification?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and really appreciate&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 10:13:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3501077#M114447</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2023-10-27T10:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3501139#M114448</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp;- this is the error I am getting :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I typed in your code verbatim.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2023 11:04:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3501139#M114448</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2023-10-27T11:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3503486#M114528</link>
      <description>&lt;LI-CODE lang="cpp"&gt;Table.AddColumn(Custom2, "Ingredient", each
            List.Skip(
                      {{{"50%","sugarlo"},"SugarLo"},
                       {{"Stevia","Green"},"Stevia"},
                       {{"classic","cook","zero calorie"},"Sucralose"},
                       {{"original","Low Calories"},"Aspartame"},
                       {{"xylitol"},"Xylitol"}
                      },
                      (x)=&amp;gt;not List.Contains(x{0},[Title],(x,y)=&amp;gt;Text.Contains(y,x,Comparer.OrdinalIgnoreCase))
                      ){0}?{1}?
               )&lt;/LI-CODE&gt;
&lt;P&gt;please&amp;nbsp; change List.ContainsAny to List.Contains&lt;/P&gt;</description>
      <pubDate>Sun, 29 Oct 2023 23:46:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3503486#M114528</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-10-29T23:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3503792#M114539</link>
      <description>&lt;P&gt;That worked&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp;- but if you could step out the logic for me, I can then use a similar code to extract other strings - like form (tablets, sachets etc), pack size ((100,300 etc) and multipack units (1....6).&lt;/P&gt;&lt;P&gt;Also, is it possible to feed a list prepared separately, nested one as you have coded here into list.skip, so that we dont need to hard code the texts in the curly braces?&lt;/P&gt;&lt;P&gt;But many thanks anyways.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 06:07:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3503792#M114539</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2023-10-30T06:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3504026#M114545</link>
      <description>&lt;P&gt;yes, you can prepare a list separately, for each item in the list, the first item is a list of sub-string you want to search, and the second is the value you what to show.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 08:10:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3504026#M114545</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-10-30T08:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3504129#M114548</link>
      <description>&lt;P&gt;In this list :&lt;/P&gt;&lt;PRE&gt;{"50%","sugarlo"},"SugarLo"},&lt;/PRE&gt;&lt;P&gt;what is the 1st list nested within the ouuter list doing? which is the item the list is skipping actually?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 09:04:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3504129#M114548</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2023-10-30T09:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3505858#M114603</link>
      <description>&lt;P&gt;each item should like {{"50%","sugarlo"},"SugarLo"}&lt;/P&gt;
&lt;P&gt;when all the value in first item's list can not be found in the Title column, then this item&amp;nbsp;{{"50%","sugarlo"},"SugarLo"} will be skipped.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 23:53:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3505858#M114603</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-10-30T23:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3508781#M114673</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry to be a pest here but I am havig trouble working thru' the logic of the code. Appreciate your being patient with my dumb questions :&lt;/P&gt;&lt;P&gt;1. Why are we using a nested list - why cannot we use a flat list, e.g. {"50%", "sugarlo", "low calories","Aspartame"} and so on? The reaso I am asking is this is that the [Title] column also has some other information like forms, pack size etc for which we may not need a nested list as in this code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. I am also not clear as to how do you skip a nested list&lt;/P&gt;&lt;P&gt;3. In the last part of the code,&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(x)=&amp;gt;not List.Contains(x{0},[Title],(x,y)=&amp;gt;Text.Contains(y,x,Comparer.OrdinalIgnoreCase))
                      ){0}?{1}?&lt;/PRE&gt;&lt;P&gt;I can see you are using the logic for skipping the list, but I did not understand the following :&lt;/P&gt;&lt;P&gt;a. where is variable (x) getting its value from? and why are using the 1st positing by using x{0}?&lt;/P&gt;&lt;P&gt;b. I am not able to understand the 3rd parameter within the list.contains&lt;/P&gt;&lt;P&gt;c. where is variable (y) getting its value from&lt;/P&gt;&lt;P&gt;d. Then in the last part why are we using {0} and then {1} positions and of which list?&lt;/P&gt;&lt;P&gt;Possibly all dumb questions but if I get this logis straight, I can reconstruct the code for extracting the other text strings :&lt;/P&gt;&lt;P&gt;a. Form - "tablets","jars","pouch","sachets"&lt;/P&gt;&lt;P&gt;b. Pack size - "100","300","500","50","100","150" etc&lt;/P&gt;&lt;P&gt;c. Multi pack - "1","2","3","4","5","6"&lt;/P&gt;&lt;P&gt;Appreciate the leg-up and apologies for the long-winded question!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 05:24:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3508781#M114673</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2023-11-01T05:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3508886#M114674</link>
      <description>&lt;P&gt;1 if use flat list, you can not get the replacement when more than one substrings be assigned a replacement. the list can be re-write as this&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;{"50%","SugarLo"},
{"sugarlo","SugarLo"},
{"Stevia","Stevia"},
{"Green","Stevia"},
{"classic","Sucralose"},
{"cook","Sucralose"},
{"zero calorie""Sucralose"},
{"original","Aspartame"},
{"Low Calories","Aspartame"},
{"xylitol","Xylitol"}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;and re-write the second arguement as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(x)=&amp;gt;Text.Contains([Title],x,Comparer.OrdinalIgnoreCase)&lt;/P&gt;
&lt;P&gt;I just intergerate the same replacement into one item.&lt;/P&gt;
&lt;P&gt;2&amp;nbsp;(ItemFromSupportingList)=&amp;gt;not List.Contains(ItemFromSupportingList{0},[Title],(1stArguement,2ndArgument)=&amp;gt;Text.Contains(2ndArgument,1stArguement,Comparer.OrdinalIgnoreCase))&lt;BR /&gt;){0}?{1}?&lt;/P&gt;
&lt;P&gt;{0} is select the first value of the list after skiping all the items not match the condition. this value will be in the structure as {list,text}, then {1} to get the "text" as the replacement.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 06:18:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3508886#M114674</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-11-01T06:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3508905#M114675</link>
      <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp; for the clear explanation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suppose the text string also contains sub-strings like 50,500 and 5 - is there a way we can extrat the "5" from the single "5", but not from "50 and "500"? That along with a remodification of this code can help extract the pack sizes and selling units from the [Title] string?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 06:37:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3508905#M114675</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2023-11-01T06:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3508988#M114679</link>
      <description>&lt;P&gt;could you provide some sample data along with the desire output?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 07:24:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3508988#M114679</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-11-01T07:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3509066#M114682</link>
      <description>&lt;P&gt;The source data remains same...&lt;/P&gt;&lt;P&gt;The code I am using to extract the form is as below :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table.AddColumn(Ingredients, "Form", each if Text.Contains([Title],"tablets",Comparer.OrdinalIgnoreCase) or Text.Contains([Title],"tablet",Comparer.OrdinalIgnoreCase) or Text.Contains([Title],"500 pcs",Comparer.OrdinalIgnoreCase) 
        or Text.Contains([Title],"330",Comparer.OrdinalIgnoreCase) or Text.Contains([Title],"440",Comparer.OrdinalIgnoreCase) or Text.Contains([Title],"550",Comparer.OrdinalIgnoreCase)
        then "Tablets" else 
        if Text.Contains([Title],"sachet",Comparer.OrdinalIgnoreCase) or Text.Contains([Title],"sachets",Comparer.OrdinalIgnoreCase) then "Sachets" else 
        if Text.Contains([Title],"500 g",Comparer.OrdinalIgnoreCase) or  Text.Contains([Title],"500g",Comparer.OrdinalIgnoreCase)
            or Text.Contains([Title],"xylitol",Comparer.OrdinalIgnoreCase) then "Pouch" else 
        if Text.Contains([Title],"80",Comparer.OrdinalIgnoreCase)  or 
        Text.Contains([Title],"150g",Comparer.OrdinalIgnoreCase) or 
        Text.Contains([Title],"150 g",Comparer.OrdinalIgnoreCase) or 
        Text.Contains([Title],"150gm",Comparer.OrdinalIgnoreCase) or 
        Text.Contains([Title],"150 GRAM",Comparer.OrdinalIgnoreCase)
        
        then "Jar" else "Tablets"
                
        )&lt;/LI-CODE&gt;&lt;P&gt;The code I am using to extract the sizes is as below :&lt;/P&gt;&lt;P&gt;a. First I remove all text from the [Title] string :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table.AddColumn(MPU, "Remove Text", each Text.Remove([Title],{"A".."Z","a".."z"}))&lt;/LI-CODE&gt;&lt;P&gt;b. This returns a column as below :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;c. from this column now, I feed a pre-prepared list :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;into the following code to extract the matching strings :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; Table.AddColumn(RemoveTextFromTitle, "Pack", each List.Select(PackList,
            (x)=&amp;gt;
            Text.Contains([Remove Text],x,Comparer.OrdinalIgnoreCase)
            ){0}?)&lt;/LI-CODE&gt;&lt;P&gt;d. This returns a column as below :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;e. I now clean up the above the column, by feeding another list with corrected packlist :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;by using the following code :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;List.Accumulate({0..Table.RowCount(PackSize)-1},
                                PackPosition,
                                        (x,y)=&amp;gt;
                                            Table.ReplaceValue(x, 
                                                PackSize[OldValue]{y}, PackSize[NewValue]{y},
                                                Replacer.ReplaceValue, {"Pack"})
                                
    )&lt;/LI-CODE&gt;&lt;P&gt;Little long-winded, but I could not find a simpler way to get to this in fewer steps.&lt;/P&gt;&lt;P&gt;Any help appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 07:54:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3509066#M114682</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2023-11-01T07:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3509209#M114688</link>
      <description>&lt;P&gt;it looks like more complicated.&lt;/P&gt;
&lt;P&gt;i can not get the whole story depending on what you showed&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 08:56:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3509209#M114688</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-11-01T08:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3509255#M114690</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry I confused you unintentionally. let me try and simplify this for you :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. We are starting with the same column as above :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;2. This text string, contains terms like sachets, tablets and jars - which are the forms. I want to extract these sub-strings from this column and the desired output should be to add a column headed "Form" with the strings as below :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;3. Next if you notice, the text string column also includes number strings as - 100,300, 500, 80,50 etc. These are pack sizes. The desired output would be to extract these strings into a separate column headed "pack Size" :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Not sure if that has simplified things a bit and helps you better with the solution I am seeking.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 09:24:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3509255#M114690</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2023-11-01T09:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3510725#M114761</link>
      <description>&lt;LI-CODE lang="cpp"&gt;Table.SplitColumn(Custom2, "Title", each
            let 
                  fx=(x,y)=&amp;gt;List.RemoveItems(Splitter.SplitTextByAnyDelimiter(x)(y),{"",null}),
                  Ingredient=List.Skip(
                      {{{"50%","sugarlo"},"SugarLo"},
                       {{"Stevia","Green"},"Stevia"},
                       {{"classic","cook","zero calorie"},"Sucralose"},
                       {{"original","Low Calories"},"Aspartame"},
                       {{"xylitol"},"Xylitol"}
                      },
                      (x)=&amp;gt;not List.Contains(x{0},_,(x,y)=&amp;gt;Text.Contains(y,x,Comparer.OrdinalIgnoreCase))
                      ){0}?{1}?,
                  Form=fx(fx(YourFormList,_),_){0}?,
                  PackSize=fx(fx(YourPackSizeList,_),_){0}?,
                  MultiPack=fx(fx(YourMulitPackList,_),){0}?
                in {Ingredient,Form,PackSize,MultiPack}
               {"Ingredient","Form","PackSize","MultiPack"})&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 01 Nov 2023 23:57:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3510725#M114761</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2023-11-01T23:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Extract text (sub) strings from a text string using a pre-specified list</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3510987#M114770</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="264353" data-lia-user-login="wdx223_Daniel" class="lia-mention lia-mention-user"&gt;wdx223_Daniel&lt;/a&gt;&amp;nbsp;- will definitely try this out and let you the result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really appreciate the help. This will help me immensely.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 03:59:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/Extract-text-sub-strings-from-a-text-string-using-a-pre/m-p/3510987#M114770</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2023-11-02T03:59:46Z</dc:date>
    </item>
  </channel>
</rss>

