SOLVED

Extract Text from Cells in excel

%3CLINGO-SUB%20id%3D%22lingo-sub-1217013%22%20slang%3D%22en-US%22%3EExtract%20Text%20from%20Cells%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1217013%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20report%20which%20is%20run%20daily%20and%20from%20this%20we%20follow%20up%20each%20item%20if%20required.%20To%20help%20make%20the%20process%20easier%20to%20follow%20up%20i%20wish%20to%20separate%20the%20information%20on%20the%20cell%20into%20smaller%20components.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20attached%20the%20reported%20data%20is%20in%20column%20A%2C%20and%20i%20wish%20to%20break%20it%20down%20into%20columns%20B%20to%20G.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20someone%20please%20assist%20with%20this.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20kindly%20for%20any%20assistance.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1217013%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECharting%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%20for%20web%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%20on%20Mac%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%20on%20mobile%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPower%20BI%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EUser%20Adoption%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1217263%22%20slang%3D%22en-US%22%3ERe%3A%20Extract%20Text%20from%20Cells%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1217263%22%20slang%3D%22en-US%22%3EHello%2C%3CBR%20%2F%3E%3CBR%20%2F%3EYou%20will%20have%20to%20use%20Power%20Query%20Split%20column%20to%20split%20the%20data%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1217317%22%20slang%3D%22en-US%22%3ERe%3A%20Extract%20Text%20from%20Cells%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1217317%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F364226%22%20target%3D%22_blank%22%3E%40calof1%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat%20could%20be%20done%20by%20Power%20Query%2C%20see%20Sheet2%20in%20attached.%3C%2FP%3E%0A%3CP%3ESince%20not%20all%20categories%20are%20in%20each%20description%2C%20and%20I'm%20not%20sure%20if%20you%20have%20full%20list%20of%20them%20and%20they%20are%20always%20in%20same%20order%2C%20first%20we%20convert%20Description%20into%20the%20list%20and%20from%20that%20list%20extract%20each%20category%20based%20on%20keyword.%20That%20require%20some%20coding%20in%20M-Script%2C%20entire%20script%20is%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Elet%0A%20%20%20%20Source%20%3D%20Excel.CurrentWorkbook()%7B%5BName%3D%22Report%22%5D%7D%5BContent%5D%2C%0A%20%20%20%20TextToList%20%3D%20Table.AddColumn(Source%2C%20%22Custom%22%2C%20each%20Text.Split(%5BDescription%5D%2C%22%23(lf)%22))%2C%0A%20%20%20%20AddCatText%20%3D%20Table.AddColumn(%0A%20%20%20%20%20%20%20%20TextToList%2C%0A%20%20%20%20%20%20%20%20%22Custom.1%22%2C%0A%20%20%20%20%20%20%20%20each%20try%20List.Single(%0A%20%20%20%20%20%20%20%20%20%20%20%20List.Select(%5BCustom%5D%2C%20each%20Text.StartsWith(_%2C%22%5B%22))%0A%20%20%20%20%20%20%20%20)%20otherwise%20null%0A%20%20%20%20)%2C%0A%20%20%20%20AddTolText%20%3D%20Table.AddColumn(%0A%20%20%20%20%20%20%20%20AddCatText%2C%0A%20%20%20%20%20%20%20%20%22Tolerance%22%2C%0A%20%20%20%20%20%20%20%20each%20try%20Text.AfterDelimiter(%0A%20%20%20%20%20%20%20%20%20%20%20%20List.Single(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20List.Select(%5BCustom%5D%2C%20each%20Text.StartsWith(_%2C%22Tolerance%22))%0A%20%20%20%20%20%20%20%20%20%20%20%20)%2C%20%22%3D%22)%20otherwise%20null%0A%20%20%20%20)%2C%0A%20%20%20%20AddCurNAVText%20%3D%20Table.AddColumn(%0A%20%20%20%20%20%20%20%20AddTolText%2C%0A%20%20%20%20%20%20%20%20%22Current%20NAV%22%2C%0A%20%20%20%20%20%20%20%20each%20try%20Text.AfterDelimiter(%0A%20%20%20%20%20%20%20%20%20%20%20%20List.Single(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20List.Select(%5BCustom%5D%2C%20each%20Text.StartsWith(_%2C%22Current%22))%0A%20%20%20%20%20%20%20%20)%2C%20%22%3D%22)%20otherwise%20null%0A%20%20%20%20)%2C%0A%20%20%20%20AddPrevNAVText%20%3D%20Table.AddColumn(%0A%20%20%20%20%20%20%20%20AddCurNAVText%2C%0A%20%20%20%20%20%20%20%20%22Previous%20NAV%22%2C%0A%20%20%20%20%20%20%20%20each%20try%20Text.AfterDelimiter(%0A%20%20%20%20%20%20%20%20%20%20%20%20List.Single(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20List.Select(%5BCustom%5D%2C%20each%20Text.StartsWith(_%2C%22Previous%22))%0A%20%20%20%20%20%20%20%20)%2C%20%22%3D%22)%20otherwise%20null%0A%20%20%20%20)%2C%0A%20%20%20%20AddCheckText%20%3D%20Table.AddColumn(%0A%20%20%20%20%20%20%20%20AddPrevNAVText%2C%0A%20%20%20%20%20%20%20%20%22Check%20Value%22%2C%0A%20%20%20%20%20%20%20%20each%20try%20Text.AfterDelimiter(%0A%20%20%20%20%20%20%20%20%20%20%20%20List.Single(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20List.Select(%5BCustom%5D%2C%20each%20Text.StartsWith(_%2C%22Check%22))%0A%20%20%20%20%20%20%20%20)%2C%20%22%3D%22)%20otherwise%20null%0A%20%20%20%20)%2C%0A%20%20%20%20SplitCategory%20%3D%20Table.SplitColumn(%0A%20%20%20%20%20%20%20%20AddCheckText%2C%0A%20%20%20%20%20%20%20%20%22Custom.1%22%2C%0A%20%20%20%20%20%20%20%20Splitter.SplitTextByEachDelimiter(%7B%22-%22%7D%2C%20QuoteStyle.Csv%2C%20false)%2C%0A%20%20%20%20%20%20%20%20%7B%22Exception%20Category%22%2C%20%22Exception%22%7D%0A%20%20%20%20)%2C%0A%20%20%20%20ReplaceSemicolon%20%3D%20Table.ReplaceValue(%0A%20%20%20%20%20%20%20%20SplitCategory%2C%0A%20%20%20%20%20%20%20%20%22%3B%22%2C%0A%20%20%20%20%20%20%20%20%22%22%2C%0A%20%20%20%20%20%20%20%20Replacer.ReplaceText%2C%0A%20%20%20%20%20%20%20%20%7B%22Exception%20Category%22%2C%20%22Exception%22%2C%20%22Tolerance%22%2C%20%22Current%20NAV%22%2C%20%22Previous%20NAV%22%2C%20%22Check%20Value%22%7D%0A%20%20%20%20)%2C%0A%20%20%20%20RemoveLists%20%3D%20Table.RemoveColumns(%0A%20%20%20%20%20%20%20%20ReplaceSemicolon%2C%0A%20%20%20%20%20%20%20%20%7B%22Custom%22%7D%0A%20%20%20%20)%0Ain%0A%20%20%20%20RemoveLists%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1613059%22%20slang%3D%22en-US%22%3ERe%3A%20Extract%20Text%20from%20Cells%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1613059%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20you%20are%20safe%20and%20well.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20been%20looking%20at%20this%20example%20as%20it's%20very%20similar%20to%20a%20task%20i%20am%20currently%20working%20on%2C%20uses%20the%20same%20data.%20I%20have%20looked%20at%20the%20Power%20query%20code%20below%20but%20unsure%20how%20to%20update%20it%20for%20my%20current%20spreadsheet.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20the%20spreadsheet%20attached%20in%20the%20%22data%20input%22%20tab%2C%20column%20G%20is%20the%20same%20as%20the%20previous%20spreadsheet.%20I%20am%20hoping%20i%20can%20copy%20across%20the%20power%20query%20to%20extract%20the%20%22Tolerance%22%20%26amp%3B%20%22Check%20Value%22%20again%20into%20Column%20V%20%26amp%3B%20W.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eif%20possible%20would%20please%20provide%20any%20notes%20in%20order%20to%20assist%20with%20this%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreatly%20appreciate%20any%20possible%20assistance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EStay%20safe%2C%20and%20all%20the%20best.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1613177%22%20slang%3D%22en-US%22%3ERe%3A%20Extract%20Text%20from%20Cells%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1613177%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F364226%22%20target%3D%22_blank%22%3E%40calof1%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYes%2C%20that's%20a%20similar%20case%20but%20not%20exactly%20the%20same.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20Power%20Query%20we%20can't%20extract%20fields%20into%20some%20cells%2C%20we%20may%20transform%20column%20G%20and%20generate%20from%20it%20another%20table%20with%20that%20information.%20The%20logic%20of%20such%20transformation%20is%20not%20clear%20for%20me.%20You%20have%20records%20with%20different%20fields%2C%20for%20example%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%5BHLD050%5D%20-%20Market%20Price%20Date%20Check%20for%20Asset%206055112%20breach%20of%20Exception%20was%20caused%20for%20entity%20DEFAULT%3B%20%0AMarket%20Price%20Date%20%3D%2020190823%3B%20%0APrevious%20Market%20Price%20Date%20%3D%2020190823%3B%20%0AInfrequently%20Priced%20%3D%20false%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Eand%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%5BPRV030%5D%20%20-%20Validate%20Movement%20in%20UOI%20with%20Capital%20Movement%3B%20%0ACheck%20Value%20%3D%2081.3%20bp%3B%20%0ATolerance%20Value%20(at%20Entity%20Level%20DEFAULT)%20%3D%2030.0%20bp%3B%20%0AUOI%20Movement%20%3D%2097115.6648%3BExpected%20UOI%20Movement%20%3D%2097904.836498923046799%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EPerhaps%20you%20may%20manually%20generate%20for%20couple%20of%20such%20records%20resulting%20table%20(or%20tables%20if%20they%20are%20different%20for%20different%20types%20of%20records)%20to%20illustrate%20the%20logic%20of%20transformation%20and%20how%20resulting%20table%20shall%20looks%20like.%20If%20few%20table%20-%20what%20is%20the%20logic%20how%20to%20separate%20them.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1615180%22%20slang%3D%22en-US%22%3ERe%3A%20Extract%20Text%20from%20Cells%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1615180%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20the%20reply.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EApologies%20for%20the%20confusion%20with%20the%20logic%2C%20it%20was%20still%20being%20defined.%20I%20have%20now%20added%20a%20few%20columns%20in%20Y%20to%20AA.%20I%20have%20matched%20the%20names%20of%20the%20output%20to%20that%20mentioned%20in%20Column%20G.%20As%20such%20there%20is%20now%20a%20column%20for%20the%26nbsp%3BCurrent%20Market%20Price%20Date%2C%26nbsp%3BPrevious%20Market%20Price%20Date%20%26amp%3B%20UOI%20Movement.%20I%20think%20this%20will%20cover%20the%20two%20queries%20mentioned%20below.%20From%20here%20i%20should%20have%20all%20the%20components%20to%20be%20able%20to%20workout%20the%20formulas.%20I%20have%20included%20an%20example%20of%20each%20in%20the%20first%20two%20rows%20of%20data.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20noticed%20that%20for%20the%20Market%20Price%20date%20it%20is%20a%20number%2C%20is%20it%20an%20option%20to%20record%20it%20as%20a%20date%20to%20align%20with%20other%20dates%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20let%20me%20know%20if%20i%20can%20do%20anything%20further%20to%20help%20clarify%2C%20and%20once%20again%20i%20greatly%20appreciate%20your%20help.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1615883%22%20slang%3D%22en-US%22%3ERe%3A%20Extract%20Text%20from%20Cells%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1615883%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F364226%22%20target%3D%22_blank%22%3E%40calof1%3C%2FA%3E%26nbsp%3B%2C%20thank%20you%20for%20the%20updated%20file.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%20will%20be%20match%20better%20if%20you%20place%20data%20in%20Tables%2C%20but%20since%20you%20already%20have%20some%20other%20calculations%20I%20kept%20as%20it%20is.%20Resulting%20table%20is%20in%20columns%20AD%3AAK%2C%20in%20brief%20steps%20are%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-%20give%20names%20to%20the%20range%20we%20are%20needed.%20Here%20ColumnsBtoG%20are%20related%20columns%2C%20Exceptions%20R1%3AS18%20and%20Funds%20Q1%3AQ100.%20If%20real%20data%20requires%20more%20space%20expand%20them.%3C%2FP%3E%0A%3CP%3E-%20query%20ColumnsPtoG%2C%20split%20by%20semicolons%2C%20add%20Index%20to%20fix%20intermediate%20result%20in%20memory%20and%20keep%20sorting%3B%3C%2FP%3E%0A%3CP%3E-%20extract%20Code%20and%20unpivot%20other%20than%20Index%2C%20Code%20and%20Entity%20Code%20columns%3B%3C%2FP%3E%0A%3CP%3E-%20split%20texts%20on%20%22%3D%22%20and%20%22%20NAV%20%22%2C%20make%20other%20adjustments%20and%20pivot%20table%20values%20on%20texts%3B%3C%2FP%3E%0A%3CP%3E-%20query%20Validation%20and%20merge%20previous%20table%20with%20it%20to%20extract%20Validation%20Check%3C%2FP%3E%0A%3CP%3E-%20query%20Funds%20and%20merge%20again%20to%20extract%20Fund%20Names%3C%2FP%3E%0A%3CP%3E-%20load%20resulting%20table%20to%20the%20Excel%20sheet%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20skipped%20some%20cosmetic%20and%20adjustment%20steps%20which%20shall%20be%20to%20do%2C%20you%20may%20check%20other%20details%20in%20the%20file.%20Table%20looks%20as%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F214992iB4A6BFEE2B78A128%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1617962%22%20slang%3D%22en-US%22%3ERe%3A%20Extract%20Text%20from%20Cells%20in%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1617962%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20again%20for%20your%20help%20with%20this%2C%20you%20are%20a%20true%20asset%20and%20credit%20to%20the%20excel%20community.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20will%20explore%20this%20in%20further%20detail%20over%20the%20weekend%2C%20wish%20you%20the%20best%20for%20a%20safe%20and%20nice%20weekend%20ahead.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAll%20the%20best.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMany%20thanks%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent Contributor

Hi All.

 

I have a report which is run daily and from this we follow up each item if required. To help make the process easier to follow up i wish to separate the information on the cell into smaller components.

 

In the attached the reported data is in column A, and i wish to break it down into columns B to G.

 

Can someone please assist with this.

 

Thank you kindly for any assistance.

7 Replies
Hello,

You will have to use Power Query Split column to split the data
Best Response confirmed by calof1 (Frequent Contributor)
Solution

@calof1 

That could be done by Power Query, see Sheet2 in attached.

Since not all categories are in each description, and I'm not sure if you have full list of them and they are always in same order, first we convert Description into the list and from that list extract each category based on keyword. That require some coding in M-Script, entire script is

let
    Source = Excel.CurrentWorkbook(){[Name="Report"]}[Content],
    TextToList = Table.AddColumn(Source, "Custom", each Text.Split([Description],"#(lf)")),
    AddCatText = Table.AddColumn(
        TextToList,
        "Custom.1",
        each try List.Single(
            List.Select([Custom], each Text.StartsWith(_,"["))
        ) otherwise null
    ),
    AddTolText = Table.AddColumn(
        AddCatText,
        "Tolerance",
        each try Text.AfterDelimiter(
            List.Single(
                List.Select([Custom], each Text.StartsWith(_,"Tolerance"))
            ), "=") otherwise null
    ),
    AddCurNAVText = Table.AddColumn(
        AddTolText,
        "Current NAV",
        each try Text.AfterDelimiter(
            List.Single(
                List.Select([Custom], each Text.StartsWith(_,"Current"))
        ), "=") otherwise null
    ),
    AddPrevNAVText = Table.AddColumn(
        AddCurNAVText,
        "Previous NAV",
        each try Text.AfterDelimiter(
            List.Single(
                List.Select([Custom], each Text.StartsWith(_,"Previous"))
        ), "=") otherwise null
    ),
    AddCheckText = Table.AddColumn(
        AddPrevNAVText,
        "Check Value",
        each try Text.AfterDelimiter(
            List.Single(
                List.Select([Custom], each Text.StartsWith(_,"Check"))
        ), "=") otherwise null
    ),
    SplitCategory = Table.SplitColumn(
        AddCheckText,
        "Custom.1",
        Splitter.SplitTextByEachDelimiter({"-"}, QuoteStyle.Csv, false),
        {"Exception Category", "Exception"}
    ),
    ReplaceSemicolon = Table.ReplaceValue(
        SplitCategory,
        ";",
        "",
        Replacer.ReplaceText,
        {"Exception Category", "Exception", "Tolerance", "Current NAV", "Previous NAV", "Check Value"}
    ),
    RemoveLists = Table.RemoveColumns(
        ReplaceSemicolon,
        {"Custom"}
    )
in
    RemoveLists

Hi@Sergei Baklan 

 

Hope you are safe and well.

 

I have been looking at this example as it's very similar to a task i am currently working on, uses the same data. I have looked at the Power query code below but unsure how to update it for my current spreadsheet.

 

On the spreadsheet attached in the "data input" tab, column G is the same as the previous spreadsheet. I am hoping i can copy across the power query to extract the "Tolerance" & "Check Value" again into Column V & W.

 

if possible would please provide any notes in order to assist with this?

 

Greatly appreciate any possible assistance.

 

Stay safe, and all the best.

 

 

@calof1 

Yes, that's a similar case but not exactly the same.

 

With Power Query we can't extract fields into some cells, we may transform column G and generate from it another table with that information. The logic of such transformation is not clear for me. You have records with different fields, for example

[HLD050] - Market Price Date Check for Asset 6055112 breach of Exception was caused for entity DEFAULT; 
Market Price Date = 20190823; 
Previous Market Price Date = 20190823; 
Infrequently Priced = false;

and

[PRV030]  - Validate Movement in UOI with Capital Movement; 
Check Value = 81.3 bp; 
Tolerance Value (at Entity Level DEFAULT) = 30.0 bp; 
UOI Movement = 97115.6648;Expected UOI Movement = 97904.836498923046799;

Perhaps you may manually generate for couple of such records resulting table (or tables if they are different for different types of records) to illustrate the logic of transformation and how resulting table shall looks like. If few table - what is the logic how to separate them.

Hi@Sergei Baklan 

 

Thank you for the reply.

 

Apologies for the confusion with the logic, it was still being defined. I have now added a few columns in Y to AA. I have matched the names of the output to that mentioned in Column G. As such there is now a column for the Current Market Price Date, Previous Market Price Date & UOI Movement. I think this will cover the two queries mentioned below. From here i should have all the components to be able to workout the formulas. I have included an example of each in the first two rows of data.

 

I have noticed that for the Market Price date it is a number, is it an option to record it as a date to align with other dates? 

 

Please let me know if i can do anything further to help clarify, and once again i greatly appreciate your help. 

 

Many thanks,

 

 

@calof1 , thank you for the updated file.

 

It will be match better if you place data in Tables, but since you already have some other calculations I kept as it is. Resulting table is in columns AD:AK, in brief steps are:

 

- give names to the range we are needed. Here ColumnsBtoG are related columns, Exceptions R1:S18 and Funds Q1:Q100. If real data requires more space expand them.

- query ColumnsPtoG, split by semicolons, add Index to fix intermediate result in memory and keep sorting;

- extract Code and unpivot other than Index, Code and Entity Code columns;

- split texts on "=" and " NAV ", make other adjustments and pivot table values on texts;

- query Validation and merge previous table with it to extract Validation Check

- query Funds and merge again to extract Fund Names

- load resulting table to the Excel sheet

 

I skipped some cosmetic and adjustment steps which shall be to do, you may check other details in the file. Table looks as

image.png

Hi@Sergei Baklan 

 

Thank you again for your help with this, you are a true asset and credit to the excel community.

 

I will explore this in further detail over the weekend, wish you the best for a safe and nice weekend ahead.

 

All the best.

 

Many thanks