Using Power Query/Get & Transform (found on the Data Tab), here is the Mcode, the result and your workbook for analyis.
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Product Name", type text}, {"Amount", type any}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Product Name] <> null)),
#"Grouped Rows" = Table.Group(#"Filtered Rows", {"Product Name"}, {{"Amount of Product", each List.Sum([Amount]), type number}}),
#"Sorted Rows" = Table.Sort(#"Grouped Rows",{{"Product Name", Order.Ascending}})
in
#"Sorted Rows"
Excel 2016 (Windows) 32 bit
|
A |
B |
1 |
Product Name |
Amount of Product |
2 |
Ayam /kg |
4 |
3 |
Babat /kg |
2 |
4 |
Beras lumbung desa |
1 |
5 |
Bimoli 5L |
2 |
6 |
Daging sapi /kg |
6 |
7 |
Emping biasa /kg |
3 |
8 |
Emping matang manis /kg |
1 |
9 |
Paket Anak 3 |
1 |
10 |
Paket buah |
1 |
11 |
Suuk putih /bungkus |
2 |
12 |
sasa 100gr |
2 |
Review PQ
In the attached file
Click on any cell in the new table
On the Data Tab, click on Queries & Connections
In the right window, double click to open Query
Review PQ steps
M-code basics:
- "let" is the start of a query
- "in" is the closing of a query
- each transformation step sits in between those 2 lines
- each step line is ended by a comma, except the last one
- "Source" is always the first step (Source Data)
- After "in" you have the last step referenced
Bookmarks