merge duplicate items and subtraction at the same time between two sheets

abdo meghari

Well-known Member
Joined
Aug 3, 2021
Messages
612
Office Version
  1. 2019
hello
I have two sheets contains data and some times contain duplicate item what I want show data in sheet output ,should match between two sheets based on column B and if there are duplicates item then should merge for each sheet individual before subtraction between two sheet . so when merge should just be for columns F(QTY), H(TOTAL) should ignore column G(PRICE) I do not need it after merging should subtract based on column B between two sheets .
for instance BSJ100 QTY should merge in sheet BR to become (120+100=220 QTY ) and in sheet JAN (10+100=110) when subtract in sheet output should be 110 as in row2 . as to column H( TOTAL) , should merge in sheet BR to become (25200+23500=48700) , and in sheet JAN (2100+23500=25600)when subtract in sheet output should be 23100 as in row2 .



BRAND .xlsm
ABCDEFGH
1DATECODEBRANDTYPEORIGINQTYPRICETOTAL
21/1/2022BSJ100BS 1200R20G580THI120.00210.0025,200.00
31/2/2022BSJ101BS 1200R20G580JAP100.00230.0023,000.00
41/3/2022BSJ100BS 1200R20G580THI100.00235.0023,500.00
51/4/2022BSJ102BS 1400R20VSJJAP120.00400.0048,000.00
61/5/2022BSJ101BS 1200R20G580JAP200.00240.0048,000.00
71/6/2022BSJ107DT 315/80R22.5R184JAP10.00330.003,300.00
81/7/2022BSJ108DT 315/80R22.5G580THI20.00380.007,600.00
91/8/2022BSJ107DT 315/80R22.5R184JAP10.00350.003,500.00
101/9/2022BSJ104DT 13R22.5R187JAP100.00230.0023,000.00
111/10/2022BSJ 105BS 195/70R15CR623JAP50.00100.005,000.00
BR
Cell Formulas
RangeFormula
H2:H11H2=F2*G2


BRAND .xlsm
ABCDEFGH
1DATECODEBRANDTYPEORIGINQTYPRICETOTAL
22/2/2022BSJ104DT 13R22.5R187JAP100.00260.0026,000.00
32/3/2022BSJ100BS 1200R20G580THI10.00210.002,100.00
42/4/2022BSJ101BS 1200R20G580JAP20.00230.004,600.00
52/5/2022BSJ100BS 1200R20G580THI100.00235.0023,500.00
62/6/2022BSJ102BS 1400R20VSJJAP120.00400.0048,000.00
72/7/2022BSJ103BS 1100R20R187JAP220.00210.0046,200.00
82/8/2022BSJ102BS 1400R20VSJJAP120.00410.0049,200.00
92/9/2022BSJ 105BS 195/70R15CR623JAP100.00100.0010,000.00
102/10/2022BSJ 106BS 225/70R15CR623JAP120.00110.0013,200.00
JAN
Cell Formulas
RangeFormula
H2:H10H2=F2*G2



result
BRAND .xlsm
FGHIJKL
1ITEMCODEBRANDTYPEORIGINQTYTOTAL
21BSJ100BS 1200R20G580THI110.0023,100.00
32BSJ101BS 1200R20G580JAP280.0066,400.00
43BSJ102BS 1400R20VSJJAP120.000.00
54BSJ104DT 13R22.5R187JAP0.003,000.00
65BSJ 105BS 195/70R15CR623JAP50.005,000.00
OUTPUT


note: whwn subtraction should ignore items are new(this means if there is existed in one of sheet and not existed in other sheet)
my data are 9000 rows for both sheets .
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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