Merging columns, excluding columns, and calculating columns by division over another across sheets

Alaa mg

Active Member
Joined
May 29, 2021
Messages
343
Office Version
  1. 2019
hi
I would like macro to merge a group of columns from the other sheets In STTO sheet, the values shown in column F will be the summation of values for the same column (F) from the second and third sheets . As for column (G) , the summing process will just be from the fourth sheet of column( F). As for column (J), the summing process will be done from the second sheet for column( I) and third sheet for columns (H).As for column K, the collection process will take place from the second sheet for column (J) and fourth sheet for column (H). After doing all these steps, the values of the two columns(H,I) in sheet STTO will be extracted by dividing the columns by each other. I have put the formulas into them . so that the extraction method is done, but I do not want any formula in the output STTO sheet .
when run the macro should clear data from before brings data to update any changing , and just I want brings data without formatting (I will do that manually to avoid code slowness)
last thing if the macro could deal with 8000 rows will be great .
I hope there is no error and very clear .
CMM.xlsm
ABCDEFGHIJ
1DATEREFDELNTPORTRQTYP PURCHASEP SELLINGT PURCHAET SELLING
201/01/2010AA123ASD-12VV-1TT300100.00200.0030,000.0060,000.00
302/01/2010AA123ASD-12VV-1TT200200.00150.0040,000.0030,000.00
403/01/2010AA123ASD-12VV-1TT250120.00100.0030,000.0025,000.00
504/01/2010AA123ASD-12VV-1TT300180.00200.0054,000.0060,000.00
605/01/2010AA123ASD-12VV-1TT120250.0080.0030,000.009,600.00
706/01/2010AA123ASD-12VV-1TT100100.00100.0010,000.0010,000.00
807/01/2010AA124ASD-13VV-2TT600110.0030066,000.00180,000.00
908/01/2010AA125ASD-14VV-3TT700120.0015084,000.00105000
1009/01/2010AA126ASD-15VV-4TT800122.0020097,600.00160000
1110/01/2010AA127ASD-16VV-5TT900130.00160117,000.00144,000.00
1211/01/2010AA124ASD-13VV-2TT30080.0010024,000.0030000
1312/01/2010AA125ASD-14VV-3TT12090.007010,800.008400
1413/01/2010AA124ASD-13VV-2TT200120.0011024,000.0022,000.00
1514/01/2010AA125ASD-14VV-3TT10070.001107,000.0011000
1615/01/2010AA128ASD-154VV-41WE200120.0014024,000.0028000
ENTERING
Cell Formulas
RangeFormula
I2:I16I2=F2*G2
J2:J16J2=F2*H2



CMM.xlsm
ABCDEFGH
1DATEREFDELNTPORTRQTYP PURCHASETOTAL
201/01/2011AA123ASD-12VV-1TT10.00120.001200
302/01/2011AA123ASD-12VV-1TT10.00100.001000
403/01/2011AA123ASD-12VV-1TT10.00110.001100
504/01/2011AA123ASD-12VV-1TT10.00200.002000
605/01/2011AA123ASD-12VV-1TT10.00110.001100
706/01/2011AA123ASD-12VV-1TT10.0080.00800
807/01/2011AA124ASD-13VV-2TT100.00110.0011000
BTY
Cell Formulas
RangeFormula
H2:H8H2=F2*G2


CMM.xlsm
ABCDEFGH
1DATEREFDELNTPORTRQTYSELLING PRICET SELLING
201/01/2011AA123ASD-12VV-1TT20220.004400
302/01/2011AA123ASD-12VV-1TT10230.002300
403/01/2011AA123ASD-12VV-1TT50180.009000
504/01/2011AA123ASD-12VV-1TT20150.003000
605/01/2011AA123ASD-12VV-1TT30120.003600
706/01/2011AA123ASD-12VV-1TT40160.006400
807/01/2011AA125ASD-14VV-3TT501005000
908/01/2011AA125ASD-14VV-3TT201102200
1009/01/2011AA124ASD-13VV-2TT101501500
1110/01/2011AA126ASD-15VV-4TT102202200
1211/01/2011AA128ASD-154VV-41WE100150.0015000
1312/01/2011AA127ASD-16VV-5TT50170.008500
STY
Cell Formulas
RangeFormula
H2:H13H2=F2*G2


result
CMM.xlsm
ABCDEFGHIJK
1ITEMREFDELNTPORTRQ PURCHASEQ SELLINGP PURCHASEP SELLINGT PURCHASET SELLING
21AA123ASD-12VV-1TT1330170151.27819551313.529412201200223300
32AA124ASD-13VV-2TT120010104.166666723350125000233500
43AA125ASD-14VV-3TT92070110.65217391880101800131600
54AA126ASD-15VV-4TT800101221622097600162200
65AA127ASD-16VV-5TT900501302880117000144000
76AA128ASD-154VV-41WE2001001202802400028000
8
9
10
11
12
13
STTO
Cell Formulas
RangeFormula
H2:I7H2=J2/F2
 
Last edited:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
BTW: I have HOME sheet name in first sheet so becarfule the location others sheets in locations based on my explenation
 
Upvote 0
for instance AA123 will summing for two columns F for sheets ENTERING & BTY
so sheets ENTERING the total after summing =1270
sheets BTY the total after summing =60
so the column F in STTO =1270+60=1330
as to column F for sheet STY the total after summing =170
so the column G for sheet STTO= 170
sheets ENTERING the total for column I after summing =194000
sheets BTY the total for column H after summing =7200
so the column J in STTO =194000+7200=201200
sheets ENTERING the total for column J after summing =194600
sheets STY the total for column H after summing =28700
so the column K in STTO =194600+28700=223300
finally should extract values for columns H,I for sheet STTO by H=J/F & I=K/G
not always what show in ENTERING sheet should also be in sheet BTY .
 
Upvote 0

Forum statistics

Threads
1,214,545
Messages
6,120,132
Members
448,947
Latest member
test111

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