Group orders in the same cell, regarding the scheduled hour and supplyer name.

HUHA

New Member
Joined
Dec 7, 2019
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hello.
I have a table the following data :

ABCD
1​
Supplyer nameOrder numberScheduled dateScheduled hour
2​
Supplyer 100421492
20191209​
1100​
3​
Supplyer 100421493
20191209​
1100​
4​
Supplyer 100421604
20191209​
1100​
5​
Supplyer 200421605
20191209​
1100​
6​
Supplyer 300416136
20191209​
1200​
7​
Supplyer 300416155
20191209​
1300​
8​
Supplyer 300416161
20191209​
1400​
9​
Supplyer 500421938
20191209​
900​
10​
Supplyer 400421970
20191209​
600​
11​
Supplyer 400421971
20191209​
600​
12​
Supplyer 400421972
20191209​
600​
13​
Supplyer 400422126
20191209​
600​
14​
Supplyer 400422127
20191209​
600​



I need some help to bring the data in this format
When i have the same scheduled hour for the same supplyer , the order numbers to come in the same cell, with "/" betwen them, on one row
If i have different scheduled hours for the same supplyer, then to have the orders on the same cell only if the hour is the same.


Supplyer nameOrdersScheduled hour
Supplyer 100421492/00421493/004216041100
Supplyer 2004216051100
Supplyer 3004161361200
Supplyer 3004161551300
Supplyer 3004161611400
Supplyer 400421970/00421971/00421972/00422126/00422127600
Supplyer 500421938900

what the formula should be ?

Thank you in Advance
 
was a lucky guess, that i have to put , "Scheduled hour " over there.

I still dont get the logic of this line
Extract = Table.TransformColumns(Orders, {"Orders", each Text.Combine(List.Transform(_, Text.From), "/"), type text}),
but in time i will understand it.

Any how , thank you again , i could not do it without you.
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
maybe play with Sort
Code:
// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Grp = Table.Group(Source, {"Supplyer name", "Scheduled hour"}, {{"Count", each _, type table}}),
    Orders = Table.AddColumn(Grp, "Orders", each List.Distinct(Table.Column([Count],"Order number"))),
    Extract = Table.TransformColumns(Orders, {"Orders", each Text.Combine(List.Transform(_, Text.From), "/"), type text}),
    Reorder = Table.ReorderColumns(Extract,{"Supplyer name", "Count", "Orders", "Scheduled hour"}),
    Sort = Table.Sort(Reorder,{{"Supplyer name", Order.Ascending}, {"Scheduled hour", Order.Ascending}}),
    Type = Table.TransformColumnTypes(Sort,{{"Scheduled hour", Int64.Type}, {"Orders", type text}})
in
    Type

Extract will extract grouped orders not to records ( not to each rows) but to the single record with / between each order (horizontal)
Click on the "cell" with Table name but not on stricte Table name and look down and you will see what is under the each Table
 
Last edited:
Upvote 0
count.jpg
 
Upvote 0
Thank you Sandy666 for your info.
From today i will try to work with power query more often. I see it has some good options.
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,496
Members
449,089
Latest member
Raviguru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top