calculation at the same column based on matching two sheets to show balance

tubrak

Board Regular
Joined
May 30, 2021
Messages
216
Office Version
  1. 2019
Platform
  1. Windows
hi
I want to show the final values in column C in sheet ITEM after matching with column B for two sheets 1,2 . the calculation should sum the values in column C with sheet1 and subtracting from sheet2 and if there are new items in sheet1,2 but not are existed in sheet ITEM then should add to sheet ITEM for instance TR 200M45 MM 123H K/L SS=20+20-20 . with also brings the others items have already existed .so every time run the macro should creat new sheet based on date today with word STOCK and if change or update again in the same date(today) should update for sheet has already created and should create new sheet for next day . I put the result in sheet based on date(today) . my data are huge about more than 10000 rows
also posted here
calculation at the same column based on matching two sheets to show balance

stock1.xlsm
ABC
1S.NITEMQTY
21CTR 12-200M45 MM 123H K/L30
32TR 200M45MM LK H K/L10
43TTR 12200S45 MN 12320
54TR 1425/148V MN 123H K/L15
65TR 200M45 MM 123H K/L SS20
76TR 2.5M100* 123H K/L10
87TR 2.5M100**123H K/L20
98TR 1200M45MM LK H K/L0
109BTR-100***8 RRT-DE3423020
1110BTR-100***8 RRT-DE3423120
1211BTR-100***8 RRT-DE3423220
1312BTR-100***8 RRT-DE34233234
1413BTR-100***8 RRT-DE3423444
1514BTR-100***8 RRT-DE3423555
1615BTR-100***8 RRT-DE34236212
1716BTR-100***8 RRT-DE3423720
1817BTR-100***8 RRT-DE3423820
ITEMS




stock1.xlsm
ABC
1S.NITEMBUYING
21TR 200M451NMM LK H K/L10
32TR 2.5M100**123H K/LM20
43CCTR 12-200M45 MM 123H K/L15
54TR 200M45 MM 123H K/L SS20
65TR 2.5M100*123H K/L10
76TTRM 12200S45 MN 123420
SHEET1




stock1.xlsm
ABC
1S.NITEMSELLING
21TR 2.5M1100**123H K/L8
32TR 2.5M1100*123H K/L25
43TR 1425/148V MN 123H K/L15
54TR 200M45 MM 123H K/L SS20
65TRMN 22.5M100* 123H K/L10
79TTRR 1200S45 MN 12320
SHEET2



result


stock1.xlsm
ABC
1S.NITEMQTY
21CTR 12-200M45 MM 123H K/L30
32CCTR 12-200M45 MM 123H K/L15
43TR 200M45MM LK H K/L10
54TR 200M451NMM LK H K/L10
65TTR 12200S45 MN 12320
76TR 1425/148V MN 123H K/L0
87TR 200M45 MM 123H K/L SS20
98TR 2.5M100* 123H K/L-5
109TR 2.5M100**123H K/L32
1110TRMN 22.5M100* 123H K/L-10
1211TTRM 12200S45 MN 1234-20
1312TTRR 1200S45 MN 123-20
1413TR 1200M45MM LK H K/L0
1514BTR-100***8 RRT-DE3423020
1615BTR-100***8 RRT-DE3423120
1716BTR-100***8 RRT-DE3423220
1817BTR-100***8 RRT-DE34233234
1918BTR-100***8 RRT-DE3423444
2019BTR-100***8 RRT-DE3423555
2120BTR-100***8 RRT-DE34236212
2221BTR-100***8 RRT-DE3423720
2322BTR-100***8 RRT-DE3423820
2423BTR-100***8 RRT-DE3423920
STOCK 7-15-2022


thanks
 
Didn't wait -- here is the link to the file I recreated. You can look at each query and follow them step by step. You can see the expected results. I changed each of the query names from Query 1, Query 2, etc to more meaningful names.

 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Thanks
Two questions
First why gives me error despite of I make sure from the same structure data.?
Second does PQ deal with huge data as in vba?
 
Upvote 0
Don't know why you are getting an error. Would have to see your actual data to determine why. My guess is that either your data is not in the same layout as your sample or your tables are named differently. Also, note that my query names have been changed manually from query1 to items, etc. You will need to amend that to suit your specific case.

As to your second question. PQ can handle very big data sets. One advantage is that it can handle more than 1.6 million rows which is the max in Excel.
 
Upvote 0
As to your second question. PQ can handle very big data sets. One advantage is that it can handle more than 1.6 million rows which is the max in Excel.
impressive ! that's mean no need vba . rather can be slow when run macro for big data and crash the file .
 
Upvote 0

Forum statistics

Threads
1,216,540
Messages
6,131,255
Members
449,638
Latest member
ygdalvi

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