create report for 40000 rows to calculation stock across sheet based on sheet name in cell value

Amer Omar

New Member
Joined
Jan 27, 2024
Messages
21
Office Version
  1. 2019
Platform
  1. Windows
Hello
I have five sheets , each sheet contains data about 40000 rows .
original data for each sheet

stt.xlsm
ABCDEF
1ITEMBATCHREF NOQTYUNIT PRICETOTAL
21VBBHGY7-00FGFFH/00200.0095.0019,000.00
32VBBHGY7-01FGFFH/01230.0088.0020,240.00
43VBBHGY7-02FGFFH/02300.0095.0028,500.00
54VBBHGY7-03FGFFH/03400.0090.0036,000.00
65VBBHGY7-14FGFFH/14110.0070.007,700.00
76VBBHGY7-15FGFFH/15120.0010.001,200.00
87VBBHGY7-42FGFFH/42130.0010.001,300.00
98VBBHGY7-43FGFFH/43100.0010.001,000.00
109VBBHGY7-1319FGFFH/13191,725.00690.501,191,112.50
LAST
Cell Formulas
RangeFormula
F2:F10F2=D2*E2


stt.xlsm
ABCDEFGH
1DATECLIENTINVOICE REFBATCHREF NOQTYUNIT PRICETOTAL
212/01/2023CL-001IN A220VBBHGY7-00FGFFH/00110.0095.0010,450.00
312/01/2023CL-001IN A220VBBHGY7-01FGFFH/01115.0099.0011,385.00
412/01/2023CL-001IN A220VBBHGY7-02FGFFH/02120.00100.0012,000.00
512/01/2023CL-001IN A220VBBHGY7-03FGFFH/03125.00110.0013,750.00
612/01/2023CL-002IN A221VBBHGY7-14FGFFH/14130.0066.008,580.00
712/01/2023CL-002IN A221VBBHGY7-15FGFFH/15135.0015.002,025.00
812/01/2023CL-002IN A221VBBHGY7-42FGFFH/42195.0023.004,485.00
912/01/2023CL-002IN A221VBBHGY7-43FGFFH/43200.0024.004,800.00
1012/01/2023CL-1281IN A1500VBBHGY7-31760FGFFH/3176022.00111.002,442.00
DAILY PURCHASE
Cell Formulas
RangeFormula
H2:H10H2=F2*G2


stt.xlsm
ABCDEFGH
1DATECLIENTINVOICE REFBATCHREF NOQTYUNIT PRICETOTAL
212/01/2023CDD-00IN PP200VBBHGY7-42FGFFH/4210.0045.00450.00
312/01/2023CDD-00IN PP200VBBHGY7-43FGFFH/4315.0044.00660.00
412/01/2023CDD-00IN PP200VBBHGY7-00FGFFH/005.00100.00500.00
512/01/2023CDD-00IN PP200VBBHGY7-01FGFFH/015.00120.00600.00
612/01/2023CDD-00IN PP200VBBHGY7-42FGFFH/422.0066.00132.00
712/01/2023CDD-01IN PP201VBBHGY7-43FGFFH/432.0048.0096.00
DAILY SALES
Cell Formulas
RangeFormula
H2:H7H2=F2*G2


stt.xlsm
ABCDEFGH
1DATECLIENTINVOICE REFBATCHREF NOQTYUNIT PRICETOTAL
212/01/2023CL-001IN A220VBBHGY7-00FGFFH/0010.0095.00950.00
312/01/2023CL-001IN A220VBBHGY7-01FGFFH/0115.0099.001,485.00
412/01/2023CL-001IN A220VBBHGY7-02FGFFH/0220.00100.002,000.00
512/01/2023CL-001IN A220VBBHGY7-03FGFFH/0325.00110.002,750.00
612/01/2023CL-002IN A221VBBHGY7-14FGFFH/1430.0066.001,980.00
712/01/2023CL-002IN A221VBBHGY7-15FGFFH/1535.0015.00525.00
812/01/2023CL-002IN A221VBBHGY7-42FGFFH/4295.0023.002,185.00
912/01/2023CL-002IN A221VBBHGY7-43FGFFH/43100.0024.002,400.00
DAILY PURCHASE RTURNS
Cell Formulas
RangeFormula
H2:H9H2=F2*G2



stt.xlsm
ABCDEFGH
1DATECLIENTINVOICE REFBATCHREF NOQTYUNIT PRICETOTAL
212/01/2023CDD-00IN PP200VBBHGY7-42FGFFH/422.0045.0090.00
312/01/2023CDD-00IN PP200VBBHGY7-43FGFFH/432.0044.0088.00
DAILY SALES RETURNS
Cell Formulas
RangeFormula
H2:H3H2=F2*G2


when I write sheet name in D3 for SUMMARY sheet then should merge QTY and populate price average as in column C,D in summary sheet based on column (BATCH) and insert TOTAL row to sum column C,E

before
stt.xlsm
ABCDE
2sheet name
3
4ITEMBATCHQTYUNIT PRICETOTAL
5
6
7
8
9
10
11
Summary


result after
stt.xlsm
ABCDE
1
2sheet name
3DAILY PURCHASE
4ITEMBATCHQTYUNIT PRICETOTAL
51VBBHGY7-00280.0087.0024,360.00
62VBBHGY7-01135.0098.0013,230.00
73VBBHGY7-02145.00105.0015,225.00
84VBBHGY7-03135.0095.0012,825.00
95VBBHGY7-14130.0066.008,580.00
106VBBHGY7-15135.0015.002,025.00
11TOTAL960.0076,245.00
Summary
Cell Formulas
RangeFormula
C11,E11C11=SUM(C5:C10)
E5:E10E5=C5*D5





but if the D3 is empty then will be totally different story
should be like this
stt.xlsm
ABCDEFGHIJ
1
2sheet name
3
4ITEMBATCHLASTDAILY PURCHASEDAILY SALESDAILY PURCHASE RTURNSDAILY SALES RETURNSQUANTITYUNIT PRICETOTAL
51VBBHGY7-00200.00280.005.000.002.00477.0089.0042,453.00
62VBBHGY7-01230.00135.005.000.000.00360.0094.6734,081.20
73VBBHGY7-02300.00145.000.000.000.00445.00101.6745,243.15
84VBBHGY7-03400.00135.000.000.000.00535.0093.3349,931.55
95VBBHGY7-14110.00130.000.000.000.00240.0057.0013,680.00
106VBBHGY7-15120.00135.000.000.000.00255.0027.507,012.50
117VBBHGY7-42130.00195.0012.000.0021.00334.0016.505,511.00
128VBBHGY7-43100.00200.0017.000.0025.00308.0017.005,236.00
139VBBHGY7-13191,725.000.000.000.000.001,725.00690.501,191,112.50
1410VBBHGY7-317610.0023.000.000.000.0023.00112.002,576.00
15TOTAL4,702.001,396,836.90
Summary
Cell Formulas
RangeFormula
H5:H14H5=C5+D5-E5-F5+G5
H15,J15H15=SUM(H5:H14)
J5:J14J5=H5*I5





will create headers in row 4 based on sheet names and under header sheet should merge QTY for each sheet based on column BATCH , as to column QUANTITY should calculate based on formula I put it , the UNIT PRICE column should populate price average based on two sheets (LAST,DAILY PURCHASE) together . also if there is new batch is existed in LAST sheet and is not existed in DAILY PURCHASE sheet should show in summary sheet when D3 is empty ,if there is new batch is existed in DAILY PURCHASE sheet and is not existed in sheet LAST should show in summary sheet when D3 is empty as highlighted cells by red
last thing every time run the macro should clear data before brings data based on D3 .
if anybody needs more details please tell me.
I hope who master write code to help me for this project .
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I hope the missed data in picture 5 for DAILY SALES RETURNS sheet this is not main reason to nobody answers me after two weeks ago .
here is the correct after add missed data
stt.xlsm
ABCDEFGH
1DATECLIENTINVOICE REFBATCHREF NOQTYUNIT PRICETOTAL
212/01/2023CDD-00IN PP200VBBHGY7-42FGFFH/422.0045.0090.00
312/01/2023CDD-00IN PP200VBBHGY7-43FGFFH/432.0044.0088.00
412/01/2023CDD-00IN PP200VBBHGY7-42FGFFH/428.0040.00320.00
512/01/2023CDD-00IN PP200VBBHGY7-43FGFFH/438.0041.00328.00
612/01/2023CDD-03IN PP203VBBHGY7-42FGFFH/4211.0039.00429.00
712/01/2023CDD-04IN PP204VBBHGY7-43FGFFH/4315.0038.00570.00
DAILY SALES RETURNS
Cell Formulas
RangeFormula
H2:H7H2=F2*G2
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

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