Splitting Data in multiple rows of single column into different columns

Occasional Contributor

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

Jack Reacher

4 purchases

3 Days ago





2 purchases

10 Days ago



Ethan Hunt

10 Purchases

15 Days ago








Expected Output


Thanks & regards




6 Replies



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:

  1. Put Helper data as show in Screen Shot.
  2. Formula in cell D89, finish with Enter & fill across.





  • Adjust cell references in the formula as needed.

@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.




If your serie starts in A1. Formulas from B1 to E1

B1=IF(ISNUMBER(SEARCH(" purchase",A2)),A1,"")
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)))),"")

@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"

Screenshot 2020-11-12 at 13.21.48.png

@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.


Kind regards