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

  Рет қаралды 38,394

Chandoo

Chandoo

Күн бұрын

Пікірлер: 92
@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!
@jerrydellasala7643
@jerrydellasala7643 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 жыл бұрын
Good point Jerry. Another option I found is instead of pressing TAB if I press ENTER the autosuggest seems to do what it should.
@MohanYGK
@MohanYGK 2 жыл бұрын
Uff, you made my life simple. Thanks Chandoo Ji
@chandoo_
@chandoo_ 4 жыл бұрын
I posted a companion article on this. Check it out for more + sample file here: chandoo.org/wp/multiple-find-replace-list-accumulate/
@wayneedmondson1065
@wayneedmondson1065 4 жыл бұрын
Thanks Chandoo.. interesting challenge and technique for solving it. Will have to study further. Thanks for sharing it! Thumbs up!!
@chandoo_
@chandoo_ 4 жыл бұрын
Thanks Wayne..
@theexcelwizard23
@theexcelwizard23 5 ай бұрын
This helped me today, thanks!
@msoffice6037
@msoffice6037 4 жыл бұрын
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:)
@priyakishan
@priyakishan 3 жыл бұрын
Awesome work. You made my life damn easy. Thanks a TON
@vikramraghuwanshi9455
@vikramraghuwanshi9455 4 жыл бұрын
Outstanding as wellas mindblowing techniques for find as wellas repalce fora multile times.
@orasha4846
@orasha4846 9 ай бұрын
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?
@JonathanExcels
@JonathanExcels 4 жыл бұрын
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.
@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 :)
@GenNextAnalyst
@GenNextAnalyst 2 жыл бұрын
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 11 ай бұрын
Do you find other solution brother? I tried on my 5000+ rows and face the same problem. Thanks
@patrickbcox
@patrickbcox 3 жыл бұрын
Excellent! Exactly what I needed. New follower here. :). Thanks!!
@chandoo_
@chandoo_ 3 жыл бұрын
Welcome aboard Patrick. :)
@sandeepkumarkonagalla4411
@sandeepkumarkonagalla4411 2 жыл бұрын
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?
@santioctaviani2389
@santioctaviani2389 4 жыл бұрын
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?
@johnabram4159
@johnabram4159 3 жыл бұрын
Amazing! Than you, Chandoo! BTW, what fonts you used for the slide @ 4:00. You use great presentation slides, Chandoo.
@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
@y5jeyfuyf
@y5jeyfuyf 4 жыл бұрын
absolutely amazing, list replaced a list!
@chandoo_
@chandoo_ 4 жыл бұрын
Glad you liked it!
@KuldeepSingh-nq1vi
@KuldeepSingh-nq1vi 2 жыл бұрын
Nice and Very informative Video.
@chandoo_
@chandoo_ 2 жыл бұрын
Thanks for liking
@gnsarathbabu
@gnsarathbabu 5 ай бұрын
Hi Chandoo, how to do this replace only if two columns from both tables match
@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?
@Softwaretrain
@Softwaretrain 4 жыл бұрын
Wooow, really useful. I used List.Generate but this one is simpler. Thanks
@chandoo_
@chandoo_ 4 жыл бұрын
Glad it was helpful!
@phoenixgirl235
@phoenixgirl235 3 жыл бұрын
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.
@zoubeyrboudene8157
@zoubeyrboudene8157 3 жыл бұрын
That was insane ! thanks sir !
@chandoo_
@chandoo_ 3 жыл бұрын
🤯
@zbatevp-vlogs610
@zbatevp-vlogs610 Жыл бұрын
I don't understand the relevance of this.... List.Numbers(0, Table.RowCount(replacements)) is this just a dummy List, to satisfy the parameter?
@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 11 ай бұрын
Do you find the sollutions brother? I tried on my 5000+ rows and face the same problem
@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...
@AdityaDsouza-s1r
@AdityaDsouza-s1r 16 сағат бұрын
how can we do this if the replacement is in multiple sheets and can be in different position
@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 :)
@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
@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
@harekrushna09
@harekrushna09 4 жыл бұрын
Thank you Sir, This is very useful.
@chandoo_
@chandoo_ 4 жыл бұрын
You are welcome
@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.
@chriswall4795
@chriswall4795 4 жыл бұрын
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.
@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.
@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.
@entertainmentgalaxy971
@entertainmentgalaxy971 4 жыл бұрын
WOW. GBU. Thanks for Accumulate fun.
@chandoo_
@chandoo_ 4 жыл бұрын
Thank you Haider :)
@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. :)
@josephdoe5195
@josephdoe5195 2 жыл бұрын
Can this be replicated for multiple columns?
@abdulwahed7426
@abdulwahed7426 3 жыл бұрын
Dear Mr Chandoo What is the limit of maximum words we can replace
@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.
@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 жыл бұрын
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?
@PedroCabraldaCamara
@PedroCabraldaCamara 3 жыл бұрын
awesome. Thank you so much
@chandoo_
@chandoo_ 3 жыл бұрын
You're very welcome!
@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}
@gospelmoto2833
@gospelmoto2833 2 жыл бұрын
superb...thanks
@rrrraaaacccc80
@rrrraaaacccc80 11 ай бұрын
💯👍
@prashantpanjabi5656
@prashantpanjabi5656 4 жыл бұрын
Thank sir. This video is very useful. Sir please explain this video in HINDI.
@chandoo_
@chandoo_ 4 жыл бұрын
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… :)
@taizoondean689
@taizoondean689 3 жыл бұрын
Little difficult but thanks for helping
@chandoo_
@chandoo_ 3 жыл бұрын
No worries!
@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 9 ай бұрын
Don’t type dot when searching for the function. There’s no bug
@chandoo_
@chandoo_ 9 ай бұрын
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 жыл бұрын
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.
List.Accumulate in Power Query with Practical Examples
27:26
The Secret to List.Accumulate in Power Query
20:43
Miss Microsoft
Рет қаралды 16 М.
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
How to easily automate boring Excel tasks with Power Query!
17:10
MyOnlineTrainingHub
Рет қаралды 1,6 МЛН
You WON'T BELIEVE These 10 HIDDEN Features in Excel Power Query 🤯
12:17
Power Query Unpivot - fix 4 common data layouts (incl. workbook)
19:24
MyOnlineTrainingHub
Рет қаралды 235 М.
Aggregate Rows in Power Query with Group By
14:56
Computergaga
Рет қаралды 9 М.