Multiple Find / Replace with List.Accumulate() ~ Power Query

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 91

  • @jerrydellasala7643
    @jerrydellasala7643 2 роки тому +2

    Chandoo - great video as always! The fix for the bug that repeats the first part of an M code function (the part before the period) is to type the function WITHOUT the period. Note, that the bug (in the latest beta version of 365) is only in the dialog box when using the tools in the ribbon. The Advanced Editor no longer has the bug.
    So, in the Add Custom Column dialog box if you type "listacc" and hit [TAB], "List.Accumulate" will appear. If you had typed "list.acc", you'd get "listList.Accumulate".
    Hopefully they'll fix the bug in the dialog box soon!

    • @chandoo_
      @chandoo_  2 роки тому +1

      Good point Jerry. Another option I found is instead of pressing TAB if I press ENTER the autosuggest seems to do what it should.

  • @kevindailey1208
    @kevindailey1208 2 роки тому

    I just stumbled upon this at the perfect time, I needed a solution worked out in two days and this was it, thank you so much!

  • @JonathanExcels
    @JonathanExcels 4 роки тому +2

    Less than a month ago I was looking to do something similar. In my situation I had headers like column01, column02....column 21. I thought there must be a better way than manually retyping each column name.

  • @wayneedmondson1065
    @wayneedmondson1065 4 роки тому +2

    Thanks Chandoo.. interesting challenge and technique for solving it. Will have to study further. Thanks for sharing it! Thumbs up!!

  • @MohanYGK
    @MohanYGK 2 роки тому

    Uff, you made my life simple. Thanks Chandoo Ji

  • @GenNextAnalyst
    @GenNextAnalyst 2 роки тому +4

    First of all, thanks for the tutorial. It's very useful. However, I have 1 question, I am trying to replace 1800 over rows to standardised naming convention but it takes so long. Is there a way to speed it up? Thanks !

    • @hudzaifahhudzaifah-zv6yw
      @hudzaifahhudzaifah-zv6yw 10 місяців тому

      Do you find other solution brother? I tried on my 5000+ rows and face the same problem. Thanks

  • @msoffice6037
    @msoffice6037 4 роки тому +1

    PERFECT EXPLANATION of List.Accumulate !!! Could you, please, make a video about List.Generate?

    • @chandoo_
      @chandoo_  4 роки тому

      Thanks for the love. I will add a video on List.Generate in a while. I am looking for a practical application for this. If you have any suggestions, please comment.

    • @msoffice6037
      @msoffice6037 4 роки тому

      @@chandoo_ If I knew List.Generate:)

  • @chandoo_
    @chandoo_  4 роки тому +1

    I posted a companion article on this. Check it out for more + sample file here: chandoo.org/wp/multiple-find-replace-list-accumulate/

  • @ahsan_habib_sunny
    @ahsan_habib_sunny Рік тому

    Hey, Chandoo. Great watching this tutorial but I found using Reduce and lambda function to handle this issue as you've shown a tutorial about using this technique more than power query. Which one you think more handy to use?

  • @phoenixgirl235
    @phoenixgirl235 3 роки тому +2

    Thanks you for this. You showed that this list can work for text. What about numbers? Is it possible to replace numbers using this function?

    • @chandoo_
      @chandoo_  3 роки тому

      You can do it with numbers too. Power Query has specific data types for everything. So either convert numbers to text (Text.From() should work) or change everything to numbers.

  • @priyakishan
    @priyakishan 3 роки тому +2

    Awesome work. You made my life damn easy.
    Thanks a TON

  • @sandeepkumarkonagalla4411
    @sandeepkumarkonagalla4411 2 роки тому +1

    Hi @Chandoo
    Thanks for the video. This is very helpful.
    I have to perform this operation on a big table (Having 50 columns). So Add column is difficult.
    Is there a way to implement this for a table?

  • @theexcelwizard23
    @theexcelwizard23 4 місяці тому

    This helped me today, thanks!

  • @y5jeyfuyf
    @y5jeyfuyf 4 роки тому +1

    absolutely amazing, list replaced a list!

    • @chandoo_
      @chandoo_  4 роки тому

      Glad you liked it!

  • @lailahugrass4904
    @lailahugrass4904 2 роки тому

    Thank you for this, you gave a really nice explanation. I'd also appreciate tips or work arounds to speed this up :)

  • @santioctaviani2389
    @santioctaviani2389 3 роки тому +1

    hi chandoo, i have very big messy data of suppliers name, the problem is i can find 1 suppliers name wrote in 15 different way, I would like to uniform the name so that i can use pivot table to summarize each spend we made to these suppliers, do you know how to do it in power query?

  • @vikramraghuwanshi9455
    @vikramraghuwanshi9455 4 роки тому

    Outstanding as wellas mindblowing techniques for find as wellas repalce fora multile times.

  • @KiranKumar-pn3ul
    @KiranKumar-pn3ul Рік тому

    Hi Chandoo, thanks that was helpful, I looking for formula where if it finds the text in a cell, that cell should get replaced with another text or value or we can perform this in new column.. can you please help with the formula

  • @johnabram4159
    @johnabram4159 3 роки тому

    Amazing! Than you, Chandoo!
    BTW, what fonts you used for the slide @ 4:00.
    You use great presentation slides, Chandoo.

  • @zoubeyrboudene8157
    @zoubeyrboudene8157 3 роки тому +1

    That was insane ! thanks sir !

  • @orasha4846
    @orasha4846 7 місяців тому

    I am trying to work out how this could work if you had multiple columns as conditions. Would I have to use a helper column where concatenate the columns?

  • @chakrabmonoj
    @chakrabmonoj 2 роки тому

    This is a wonderful lesson Chandoo...I have a long list of cities, which will require this kind of replacement. Is there a way the code can run in a case-agnostic way? I have run your code on my table, but its returning the exact same names and not replacing anything really.
    Could this be happening because the target table has the city names in uppercase and the replacement table I have made, by mistake I got the city names in lowercase?
    Any help much appreciated.

    • @chandoo_
      @chandoo_  2 роки тому

      Power Query is (strangely and annoyingly) case sensitive. I would just lower case everything before doing any operations like this.

    • @chakrabmonoj
      @chakrabmonoj 2 роки тому

      @@chandoo_ I did that - changed everything to one uniform case...but there are two strange problems :
      1. If the text to replace has multiple words - like "Navi Mumbai", it is not replacing &
      2. In some cases, all instances are not getting replaced - e.g. out of 6 instances of "Howrah", 5 got replaced with the intended replacement of "Kolkata", but one instance did not.
      Can you throw some light on that?
      Thanks

  • @sandyfreborg2464
    @sandyfreborg2464 Рік тому

    Chandoo - This is great. However, when I try this myself, it takes a LONG time to load. My data sets are small to start (10 rows and 30 columns in the data, and 10 rows of special character to hexidecimal code). Any thoughts on what could be happening? Its getting up to the 9 GB size and takes over a day to load.

    • @hudzaifahhudzaifah-zv6yw
      @hudzaifahhudzaifah-zv6yw 10 місяців тому

      Do you find the sollutions brother? I tried on my 5000+ rows and face the same problem

  • @Softwaretrain
    @Softwaretrain 4 роки тому

    Wooow, really useful. I used List.Generate but this one is simpler.
    Thanks

    • @chandoo_
      @chandoo_  4 роки тому

      Glad it was helpful!

  • @gnsarathbabu
    @gnsarathbabu 4 місяці тому

    Hi Chandoo, how to do this replace only if two columns from both tables match

  • @rleigh5204
    @rleigh5204 2 роки тому

    Wonderful explanation! Is there a way to combine the functionality of list.accumulate with splitting text over several delimiters? I've been working for several hours on this but I'm coming up empty. Any help would be greatly appreciated.

    • @chandoo_
      @chandoo_  2 роки тому

      Thanks R L. If your delimiters are single chars, you can use = Text.SplitAny()
      For example, = Text.SplitAny("something or other, but not both. Mr", " ,.") will split the text for any of the space, comma or period delimiters

  • @patrickbcox
    @patrickbcox 3 роки тому

    Excellent! Exactly what I needed. New follower here. :). Thanks!!

    • @chandoo_
      @chandoo_  3 роки тому

      Welcome aboard Patrick. :)

  • @KuldeepSingh-nq1vi
    @KuldeepSingh-nq1vi 2 роки тому

    Nice and Very informative Video.

  • @defaultHandle1110
    @defaultHandle1110 3 роки тому

    Please do a video showing how to do dynamic replacement using a list of columns, also at the same time, to make the replacement conditional.

    • @chandoo_
      @chandoo_  3 роки тому

      Sure. I will think about this.

    • @IrshadKhan-nd2rg
      @IrshadKhan-nd2rg 2 роки тому

      Hi, Thanks for the video... I was looking for something like - I want to replace "Apple lghlkdshlhdshglsh" with "Apple" so i have used * sign in excel vba to replace unknow things after Apple... but power query gave me error using the same thing in power query.

  • @ericng8811
    @ericng8811 3 роки тому

    You are a genius!

    • @chandoo_
      @chandoo_  3 роки тому

      Thanks Eric.. I am glad you found this useful :)

  • @zbatevp-vlogs610
    @zbatevp-vlogs610 Рік тому +1

    I don't understand the relevance of this....
    List.Numbers(0, Table.RowCount(replacements))
    is this just a dummy List, to satisfy the parameter?

  • @josephdoe5195
    @josephdoe5195 2 роки тому

    Can this be replicated for multiple columns?

  • @chriswall4795
    @chriswall4795 3 роки тому

    Haven’t tried this yet, but it will replace part words, won’t it? Could produce issues at times. Also would be case sensitive for text.
    Example:
    Find six Replace four would change sixteen to fourteen but also sixty to fourty... and would fail if there is capitalisation : Sixteen would remain unchanged.
    That said, I foresee using this as a powerful data cleansing trick.

  • @abdulwahed7426
    @abdulwahed7426 3 роки тому

    Dear Mr Chandoo What is the limit of maximum words we can replace

  • @MohanYGK
    @MohanYGK 2 роки тому

    Greetings from Riyadh, Saudi Arabia.
    I am working in Retail Industry. On an average we have 500 K invoices in a month and mostly customers are paying by Card. We have over 125 stores spreading across in 32 cities.
    Unfortunately our banker is not giving POS # (Point of Sales machine number) in a separate column. It is part of Transaction description. More over POS Machine # is not fixed in the transaction description.
    We have POS Machine # and Store ID for all 125 stores (POS Master File). Is there any possibility to get the following solution from Power Query:
    ---> Identify POS Machine in the Transaction description table and add Store ID in a separate column based on the POS Master file. I tried List.Accumulate function but it is replacing POS # with StoreID in the same column along with other text. But I need store id exclusively in different column. Looking forward your solution brother.

  • @yassinenj1766
    @yassinenj1766 4 роки тому

    How can we change the whole value of the cell and not only a part of the text ?
    (I'm trying to use the Table.ReplaceValue instead of the text.replace but it gives me
    an error).
    And how can we do the replacements in the original column without creating a new one ?
    Thanks you

    • @chandoo_
      @chandoo_  4 роки тому

      Hi Yassine... just use Replace values button in the Home ribbon of Power Query editor for this.

    • @yassinenj1766
      @yassinenj1766 4 роки тому

      @@chandoo_ Hello, what i mean is how to do it in the context of your formula, because i'm also usng another table as a reference.

  • @snehaciril
    @snehaciril Рік тому

    Hai sir, i would like to know
    From a particular list if there is a value is null, then pick the value from the next column how can I exicute this through power query...

  • @larmondoflairallen4705
    @larmondoflairallen4705 2 роки тому

    This is very very good, but when we want to replace values, we want to replace them in the existing column, not create a new column. Since Table.ReplaceValue is a very different kind of function than Table.AddColumn, I wonder how you could implement this solution to change the values without creating a new column.

    • @chandoo_
      @chandoo_  2 роки тому +1

      There is no cost to creating a new columns in PQ. So instead of figuring something else out, why not add the column with the replacement logic and then remove the original column?

  • @harekrushna09
    @harekrushna09 4 роки тому

    Thank you Sir, This is very useful.

  • @davidferrick
    @davidferrick 3 роки тому

    How can I tweak this to show a column of the keywords found instead of replacing the text?

    • @chandoo_
      @chandoo_  3 роки тому

      Good idea. Why not try playing around in PQ and see which M functions can let you do that.

    • @davidferrick
      @davidferrick 3 роки тому

      @@chandoo_ LOL, I cheated and used my replace values encapsulted in delimiters and then extracted between delimiters to create a bucket. :)

  • @gospelmoto2833
    @gospelmoto2833 2 роки тому

    superb...thanks

  • @arenddickman6922
    @arenddickman6922 4 роки тому

    Thanks a lot. I already used it at work. A small error has crept in ... After Table.RowCount -1 is unnecessary. Skip the last line.

    • @chandoo_
      @chandoo_  4 роки тому

      Yes, you are right. Yeah, it was an error that I had too. If you see the video at end, I realize that mistake and fix it.

    • @arenddickman6922
      @arenddickman6922 4 роки тому

      I'm inattentive ... I'm sorry. You can also create a list like you at the beginning of the movie. {0 .. Table.Row.Count (tablename) -1}

  • @shreedharan.moorthy
    @shreedharan.moorthy 2 роки тому

    i tried this in my report in which Style number should be replaced by Style group (ex AM1234 as A/1234. This is for 1000 of rows with multiple such style group. Getting error.

  • @PedroCabraldaCamara
    @PedroCabraldaCamara 3 роки тому

    awesome. Thank you so much

    • @chandoo_
      @chandoo_  3 роки тому

      You're very welcome!

  • @RaviGupta-mo1nf
    @RaviGupta-mo1nf 3 роки тому

    I used your technique to change header names coming from multiple excel files. But ALL List.Accumulate did was to capitalize each word in the header.
    Any reason why?

    • @chandoo_
      @chandoo_  3 роки тому

      It depends on what you are using to ACCUMULATE. See the video again and examine description links as this is a tricky concept.

  • @entertainmentgalaxy971
    @entertainmentgalaxy971 4 роки тому

    WOW. GBU. Thanks for Accumulate fun.

    • @chandoo_
      @chandoo_  4 роки тому +1

      Thank you Haider :)

  • @rrrraaaacccc80
    @rrrraaaacccc80 10 місяців тому

    💯👍

  • @taizoondean689
    @taizoondean689 3 роки тому

    Little difficult but thanks for helping

  • @prashantpanjabi5656
    @prashantpanjabi5656 4 роки тому

    Thank sir. This video is very useful.
    Sir please explain this video in HINDI.

    • @chandoo_
      @chandoo_  4 роки тому +1

      Hi Prashant.... Thanks. I am glad you enjoyed it. I am not proficient in Hindi. But I will try add a Hindi or Telugu video once in a while. As Excel interface and resources are all in English, it is a lot easier to explain in that. As they say... koshish karoonga… :)

  • @SujonAhmed26
    @SujonAhmed26 4 роки тому

    Great

  • @inkuban
    @inkuban Рік тому

    Why not use List.Generate, I don't see the point in having a state.

    • @chandoo_
      @chandoo_  Рік тому

      Sure. If that method works for you, use it.

  • @Kasia_uk
    @Kasia_uk 8 місяців тому

    Don’t type dot when searching for the function. There’s no bug

    • @chandoo_
      @chandoo_  8 місяців тому +1

      In my book, it is a bug. The Power Query intellisense has been buggy for years and just shows developers are not thinking thru real-world scenarios.

  • @syamkumar-tc3xo
    @syamkumar-tc3xo 3 роки тому +1

    Not explained in effective way

    • @chandoo_
      @chandoo_  3 роки тому

      List.Accumulate is one of the trickiest to understand and explain. If you mastered it, feel free to make a video or blog article and share it with us.