merge duplicates item for 70K rows and re-price for each sheet individually

KalilMe

Active Member
Joined
Mar 5, 2021
Messages
354
Office Version
  1. 2016
Platform
  1. Windows
Hi
I need merging duplicate items for 2500-4000 reference and 70K rows for each sheet individually
so should merge duplicate items for each sheet alone( not across sheets ) based on column C . as to summing values for duplicated item should just be the columns QTY,TOTAL and should ignores columns DATE(should replace of it numbers 1,2,3) , ORDER,PRICE when merging should be as in the result , populate re-price in column G=H/F for result sheets.


COLLECTION .xlsm
ABCDEFGHI
1DATEORDERCO-ITFOODTT-MMNORT-WWQTYPRICETOTAL
201/01/2022OR/1-00COR-FF1FRBANANATT200.0021.00 4,200.00
302/01/2022OR/1-01COR-FF2FRAPPLELL100.00100.00 10,000.00
403/01/2022OR/1-02COR-FF3FRPEARNN10.0010.00 100.00
504/01/2022OR/1-03COR-FF4FRBANANAQQ20.0020.00 400.00
605/01/2022OR/1-04COR-FF5VEGTOMATOSS12.0012.00 144.00
706/01/2022OR/1-05COR-FF6VEGTOMATOAA12.0012.00 144.00
801/01/2022OR/1-00COR-FF1FRBANANATT200.0020.00 4,000.00
STA
Cell Formulas
RangeFormula
I2:I8I2=G2*H2


COLLECTION .xlsm
ABCDEFGHI
1DATEORDERCO-ITFOODTT-MMNORT-WWQTYPRICETOTAL
201/02/2022OR/1-11COR-FF11FRPEACHTT120.0022.00 2,640.00
302/02/2022OR/1-12COR-FF12FRAPPLELL130.0023.00 2,990.00
403/02/2022OR/1-13COR-FF13FRPEARNN20.0012.00 240.00
504/02/2022OR/1-14COR-FF14FRBANANAQQ300.0022.00 6,600.00
605/02/2022OR/1-15COR-FF15VEGTOMATOSS234.0012.00 2,808.00
706/02/2022OR/1-16COR-FF16VEGTOMATOAA12.0012.00 144.00
807/02/2022OR/1-17COR-FF11FRPEACHTT200.0011.00 2,200.00
908/02/2022OR/1-18COR-FF16VEGTOMATOAA12.0010.00 120.00
RPA
Cell Formulas
RangeFormula
I2:I9I2=G2*H2


COLLECTION .xlsm
ABCDEFGHI
1DATEORDERCO-ITFOODTT-MMNORT-WWQTYPRICETOTAL
221/02/2022OR/1-21COR-FF12FRAPPLELL5.0023.00 115.00
322/02/2022OR/1-22COR-FF13FRPEARNN2.0012.00 24.00
423/02/2022OR/1-23COR-FF11FRPEACHTT11.0022.00 242.00
524/02/2022OR/1-24COR-FF13FRPEARNN2.0012.00 24.00
SR
Cell Formulas
RangeFormula
I2:I5I2=G2*H2



result


Result.xlsx
ABCDEFGH
1ITEMCO-ITFOODTT-MMNORT-WWQTYUNIT PRICETOTAL
21COR-FF1FRBANANATT400.0020.508,200.00
32COR-FF2FRAPPLELL100.00100.0010,000.00
43COR-FF3FRPEARNN10.0010.00100.00
54COR-FF4FRBANANAQQ20.0020.00400.00
65COR-FF5VEGTOMATOSS12.0012.00144.00
76COR-FF6VEGTOMATOAA12.0012.00144.00
STA


Result.xlsx
ABCDEFGH
1ITEMCO-ITFOODTT-MMNORT-WWQTYUNIT PRICETOTAL
21COR-FF11FRPEACHTT320.0015.134,840.00
32COR-FF12FRAPPLELL130.0023.002,990.00
43COR-FF13FRPEARNN20.0012.00240.00
54COR-FF14FRBANANAQQ300.0022.006,600.00
65COR-FF15VEGTOMATOSS234.0012.002,808.00
76COR-FF16VEGTOMATOAA24.0012.00288.00
RPA



Result.xlsx
ABCDEFGH
1ITEMCO-ITFOODTT-MMNORT-WWQTYUNIT PRICETOTAL
21COR-FF12FRAPPLELL5.0023.00115.00
32COR-FF13FRPEARNN4.0012.0048.00
43COR-FF11FRPEACHTT11.0022.00242.00
SR
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I have only shown the solution for the first example. Once you understand this process, you can apply it to the others

Book2
ABCDEFGHI
1DATEORDERCO-ITFOODTT-MMNORT-WWQTYPRICETOTAL
21/1/2022OR/1-00COR-FF1FRBANANATT200214200
32/1/2022OR/1-01COR-FF2FRAPPLELL10010010000
43/1/2022OR/1-02COR-FF3FRPEARNN1010100
54/1/2022OR/1-03COR-FF4FRBANANAQQ2020400
65/1/2022OR/1-04COR-FF5VEGTOMATOSS1212144
76/1/2022OR/1-05COR-FF6VEGTOMATOAA1212144
81/1/2022OR/1-00COR-FF1FRBANANATT200204000
9
10
11IndexORDERQuantityRePriceNew TotalTable5 (2).FOODTable5 (2).TT-MMNTable5 (2).ORT-WW
121OR/1-0040020.58200FRBANANATT
132OR/1-0110010010000FRAPPLELL
143OR/1-021010100FRPEARNN
154OR/1-032020400FRBANANAQQ
165OR/1-041212144VEGTOMATOSS
176OR/1-051212144VEGTOMATOAA
Sheet5
Cell Formulas
RangeFormula
I2:I8I2=G2*H2


Load the first table into the Power Query Editor and apply the following Mcode

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table5"]}[Content],
    #"Grouped Rows" = Table.Group(Source, {"ORDER"}, {{"Quantity", each List.Sum([QTY]), type number}, {"RePrice", each List.Average([PRICE]), type number}, {"New Total", each List.Sum([TOTAL]), type number}}),
    #"Added Index" = Table.AddIndexColumn(#"Grouped Rows", "Index", 1, 1, Int64.Type),
    #"Reordered Columns" = Table.ReorderColumns(#"Added Index",{"Index", "ORDER", "Quantity", "RePrice", "New Total"})
in
    #"Reordered Columns"

Merge this query back onto the original source data table.

l
Power Query:
et
    Source = Table.NestedJoin(Table5, {"ORDER"}, #"Table5 (2)", {"ORDER"}, "Table5 (2)", JoinKind.LeftOuter),
    #"Expanded Table5 (2)" = Table.ExpandTableColumn(Source, "Table5 (2)", {"FOOD", "TT-MMN", "ORT-WW"}, {"Table5 (2).FOOD", "Table5 (2).TT-MMN", "Table5 (2).ORT-WW"}),
    #"Removed Duplicates" = Table.Distinct(#"Expanded Table5 (2)", {"ORDER"})
in
    #"Removed Duplicates"
 
Upvote 0
Well, I was waiting for body to gives me macro ,but I will try currently. Where I put this?
Sorry this the first time use PQ.
 
Upvote 0
Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Upvote 0
thanks for the links .:) I will try and inform you how goes .
 
Upvote 0
Hi Alan
I no know what's the problem ! when I enter inside PQ Editor the advanced editor is disabled !
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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