Count cells with same value and create summary

skpma

New Member
Joined
Mar 3, 2020
Messages
31
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hello everyone

I need to create some kind of a summary for an order.
The orderfile looks like this:
Book1
ABCDEFGHIJKL
1OrderdayOrdernumberStorenumberMakernumberArticlenumberArticlenamePackagecontentUnitPriceAmountArrivaldayTime
220200622728001102345996K000141Article A150Single251202006251
320200622729001103245198K000148Article B60Single201202006250
420200622730001107545996K000141Article A150Single251202006250
520200622731001107745197K000147Article C36Single201202006250
620200622731002107745198K000148Article B60Single201202006250
720200622732001107845996K000141Article A150Single251202006250
820200622734002108845996K000141Article A150Single251202006250
Sheet1


On a second sheet I want to count the number of occurrences of an article, copy some values and give out the total price amount. It should be based on the occurrence of the maker number.

Book1
ABCDEFGHIJK
1ShippingdayDeliverydayArrivaldayMakernumberArticlenumberArticlenamePackagecontentUnitOccurrencePriceTotal Amount
22020062545996K000141Article A150Single425100
32020062545198K000148Article B60Single22040
42020062545197K000147Article C36Single12020
Sheet2
Cell Formulas
RangeFormula
K2:K4K2=I2*J2


Is this achievable? I'm thankful for every hint, doesn't have to be the solution.
Thanks in advance.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Using Power Query/Get and Transform.
1. Bring your table into PQ and Group on the MakeNumber
Rich (BB code):
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Orderday", Int64.Type}, {"Ordernumber", Int64.Type}, {"Storenumber", Int64.Type}, {"Makernumber", Int64.Type}, {"Articlenumber", type text}, {"Articlename", type text}, {"Packagecontent", Int64.Type}, {"Unit", type text}, {"Price", Int64.Type}, {"Amount", Int64.Type}, {"Arrivalday", Int64.Type}, {"Time", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Makernumber"}, {{"Occurance", each Table.RowCount(_), type number}})
in
    #"Grouped Rows"
2. Replicate your table that you just amended, but remove all steps except the first
Rich (BB code):
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content]
in
    Source
3. Merge your two tables with a Left Inner Join
4. Expand your table to include all columns except MakeNumber which is already there
5. Move your Occurance field to the end of the table.
6. Multiply the Occurance by the Price in an added column
Rich (BB code):
let
    Source = Table.NestedJoin(Table1, {"Makernumber"}, #"Table1 (2)", {"Makernumber"}, "Table1 (2)", JoinKind.LeftOuter),
    #"Expanded Table1 (2)" = Table.ExpandTableColumn(Source, "Table1 (2)", {"Orderday", "Ordernumber", "Storenumber", "Articlenumber", "Articlename", "Packagecontent", "Unit", "Price", "Amount", "Arrivalday", "Time"}, {"Orderday", "Ordernumber", "Storenumber", "Articlenumber", "Articlename", "Packagecontent", "Unit", "Price", "Amount", "Arrivalday", "Time"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded Table1 (2)",{"Makernumber", "Orderday", "Ordernumber", "Storenumber", "Articlenumber", "Articlename", "Packagecontent", "Unit", "Price", "Amount", "Arrivalday", "Time", "Occurance"}),
    #"Removed Duplicates" = Table.Distinct(#"Reordered Columns", {"Makernumber"}),
    #"Inserted Multiplication" = Table.AddColumn(#"Removed Duplicates", "Multiplication", each [Price] * [Occurance], type number),
    #"Renamed Columns" = Table.RenameColumns(#"Inserted Multiplication",{{"Multiplication", "Total"}})
in
    #"Renamed Columns"

Book2
ABCDEFGHIJKLMN
1MakernumberOrderdayOrdernumberStorenumberArticlenumberArticlenamePackagecontentUnitPriceAmountArrivaldayTimeOccuranceTotal
245996202006227280011023K000141Article A150Single2512020062514100
345198202006227290011032K000148Article B60Single201202006250240
445197202006227310011077K000147Article C36Single201202006250120
Sheet4
 
Upvote 0
Thank you for your answer.
This works, and is good for a one time use but I have to do this multiple times a day with different workbooks. Would require training on user side too.
Was more thinking about a VBA macro or formula where everything is automated.
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,175
Members
449,071
Latest member
cdnMech

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