11-12-2020 01:00 AM
11-12-2020 01:00 AM
Please can you look at the sample raw data and expected output here below which should help understand how the data is set up and the desired output.
I would like to be able to split the rows at every name ( or any other suggestion ) at the rest of the data can move into adjacent column
Can i request help in getting this done?
( Would like to get this done in power query preferably )
Sample raw data in notepad
3 Days ago
10 Days ago
15 Days ago
Thanks & regards
11-12-2020 02:51 AM - edited 11-12-2020 02:53 AM
Your data has no uniformity like name intervals are not common therefore any single formula or method will not work properly. The simplest I can suggest is TRANSPOSE. Which need to use block wise.
Like Copy Jack Reacher to Others, then Harry potter to Owls and so next.
Another is this, possibly help you.
How it works:
11-12-2020 03:31 AM
@Rajesh-S Thank you for the response, however if you notice there is a repeat pattern occurring which is the line ending as X purchases, I was hoping if I can find a way to leverage that.
I am positive there must bea way to break the data at that level and move the balance into the next column, we just need to figure out a way.
I'll keeping looking out for solutions, meanwhile if this point trigger something to you, do please help.
11-12-2020 04:22 AM - edited 11-12-2020 04:51 AM
If your serie starts in A1. Formulas from B1 to E1
E1=IF(D1<>"",TEXTJOIN(" ",,OFFSET(A4,0,0,MATCH("* purchase*",A4:A10000,0)-2)),"")
E-column will be wrong for the last post. try something like:
'=IF(D1<>"",TEXTJOIN(" ",,OFFSET(A4,0,0,IFERROR(MATCH("* purchase*",A3:A10000,0)-2,MATCH("*",A3:A10000,-1)))),"")
11-12-2020 04:29 AM
@DhritimanL Since you explicitly asked for a PQ solution, I'm giving you just that. I suspect that your real data is much more complicated and you don't want a lot of manual interference with helper columns and complex formulae. Or do you just want to learn about PQ?
Just add to the blue table and refresh the green one, as long as you make sure that the Name is always in the row directly above the row that includes the string "urchase". PQ is case sensitive. This way, you will capture all occurrences of "purchases", "Purchases", "purchase" and "Purchase"
11-12-2020 05:20 AM
@Riny_van_Eekelen Thank you So much, yes indeed the actual data has other key words so i went ahead and edited the m-code and replaced "purchases" with the required words and a few other minor tweak to make it work like a charm for my data.
Much appreciated and grateful.
Thank you once again.