Combine & match 2 Worksheets

thewiseguy

Well-known Member
Joined
May 23, 2005
Messages
954
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I am trying to create a VBA code which will look at my purchase order info (PO Tab) and my bills info (bill tab) and combine them in a 3rd worksheet. I'm not sure what additional information you might need but this is how I would like it to look in an ideal manner. I'm open to some variation if it gets too complex: in the following manner:

project-profit.xlsx
ABMN
1Purchase Order NumberVendor NameTotalAdjustment
2PO-01793Halco Lighting Technologies$17,809.00$0.00
3PO-01794Maxlite, Inc.$1,802.00$0.00
4PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
5PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
6PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
7PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
8PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
9PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
10PO-01797Veolia ES Technical Solutions, L.L.C$120.60$0.00
11PO-01798United Rentals$1,729.46$107.46
12PO-01798United Rentals$1,729.46$107.46
13PO-01798United Rentals$1,729.46$107.46
14PO-01798United Rentals$1,729.46$107.46
15PO-01799Louis T. Roselle Inc.$625.00$0.00
16PO-01805Feldman Brothers Electrical Supply Co.$205.76$0.00
17PO-01805Feldman Brothers Electrical Supply Co.$205.76$0.00
18PO-01806Feldman Brothers Electrical Supply Co.$391.81$0.00
19PO-01807Maxlite, Inc.$7,629.25$0.00
20PO-01807Maxlite, Inc.$7,629.25$0.00
21PO-01807-1Maxlite, Inc.$7,520.00$0.00
22PO-01811PB Lighting$378.00$0.00
23PO-01811PB Lighting$378.00$0.00
24PO-01815Maxlite, Inc.$791.75$0.00
25PO-01817Feldman Brothers Electrical Supply Co.$233.40$0.00
26PO-01821Louis T. Roselle Inc.$410.68$0.00
PO


project-profit.xlsx
ABLM
1Purchase Order NumberVendor NameTotalAdjustment
2PO-01780Halco Lighting Technologies$738.51$0.00
3PO-01793Halco Lighting Technologies$17,809.00$0.00
4PO-01794Maxlite, Inc.$933.89$0.00
5PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
6PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
7PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
8PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
9PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
10PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
11PO-01798United Rentals$1,729.46$107.46
12PO-01798United Rentals$1,729.46$107.46
13PO-01798United Rentals$1,729.46$107.46
14PO-01798United Rentals$1,729.46$107.46
15PO-01799Louis T. Roselle Inc.$753.11$0.00
16PO-01805Feldman Brothers Electrical Supply Co.$205.76$0.00
17PO-01805Feldman Brothers Electrical Supply Co.$205.76$0.00
18PO-01806Feldman Brothers Electrical Supply Co.$391.81$0.00
19PO-01807Maxlite, Inc.$142.00$0.00
20PO-01807Maxlite, Inc.$437.25$0.00
21PO-01807-1Maxlite, Inc.$7,520.00$0.00
22PO-01815Maxlite, Inc.$75.84$0.00
23PO-01817Feldman Brothers Electrical Supply Co.$233.40$0.00
24PO-01821Louis T. Roselle Inc.$410.68$0.00
25American Express$7,910.32$0.00
26Campbell Electric LLC$12,280.00$0.00
27Campbell Electric LLC$12,280.00$0.00
28EF Lighting Improvement LLC$4,400.00$0.00
29EF Lighting Improvement LLC$4,400.00$0.00
30EF Lighting Improvement LLC$4,400.00$0.00
31EF Lighting Improvement LLC$4,400.00$0.00
32Maxlite, Inc.$933.89$0.00
33Maxlite, Inc.$75.84$0.00
Bill




project-profit.xlsx
ABMNOPQAAAB
1Purchase Order NumberVendor NameTotalAdjustmentPurchase Order NumberVendor NameTotalAdjustment
2
3PO-01780Halco Lighting Technologies$738.51$0.00
4Subtotal PO-0178000Subtotal PO-01780$738.51$0.00
5
6PO-01793Halco Lighting Technologies$17,809.00$0.00PO-01793Halco Lighting Technologies$17,809.00$0.00
7Subtotal PO-01793$17,809.00$0.00Subtotal PO-01793$17,809.00$0.00
8
9PO-01794Maxlite, Inc.$1,802.00$0.00PO-01794Maxlite, Inc.$933.89$0.00
10Subtotal PO-01794$1,802.00$0.00Subtotal PO-01794$933.89$0.00
11
12PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
13PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
14PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
15PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
16PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
17PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00PO-01796Feldman Brothers Electrical Supply Co.$3,720.82$0.00
18Subtotal PO-01796$22,324.92$0.00Subtotal PO-01796$22,324.92$0.00
19
20PO-01797Veolia ES Technical Solutions, L.L.C$120.60$0.00
21Subtotal PO-01797$120.60$0.00Subtotal PO-0179700
22
23PO-01798United Rentals$1,729.46$107.46PO-01798United Rentals$1,729.46$107.46
24PO-01798United Rentals$1,729.46$107.46PO-01798United Rentals$1,729.46$107.46
25PO-01798United Rentals$1,729.46$107.46PO-01798United Rentals$1,729.46$107.46
26PO-01798United Rentals$1,729.46$107.46PO-01798United Rentals$1,729.46$107.46
27Subtotal PO-01798$6,917.84$429.84Subtotal PO-01798$6,917.84$429.84
28
29PO-01799Louis T. Roselle Inc.$625.00$0.00PO-01799Louis T. Roselle Inc.$753.11$0.00
30Subtotal PO-01799$625.00$0.00Subtotal PO-01799$753.11$0.00
31
32PO-01805Feldman Brothers Electrical Supply Co.$205.76$0.00PO-01805Feldman Brothers Electrical Supply Co.$205.76$0.00
33PO-01805Feldman Brothers Electrical Supply Co.$205.76$0.00PO-01805Feldman Brothers Electrical Supply Co.$205.76$0.00
34Subtotal PO-01805$411.52$0.00Subtotal PO-01805$411.52$0.00
35
36PO-01806Feldman Brothers Electrical Supply Co.$391.81$0.00PO-01806Feldman Brothers Electrical Supply Co.$391.81$0.00
37Subtotal PO-01806$391.81$0.00Subtotal PO-01806$391.81$0.00
38
39PO-01807Maxlite, Inc.$7,629.25$0.00PO-01807Maxlite, Inc.$142.00$0.00
40PO-01807Maxlite, Inc.$7,629.25$0.00PO-01807Maxlite, Inc.$437.25$0.00
41Subtotal PO-01807$15,258.50$0.00Subtotal PO-01807$15,258.50$0.00
42
43PO-01807-1Maxlite, Inc.$7,520.00$0.00PO-01807-1Maxlite, Inc.$7,520.00$0.00
44Subtotal PO-01807-1$7,520.00$0.00Subtotal PO-01807-1$7,520.00$0.00
45
46PO-01811PB Lighting$378.00$0.00
47PO-01811PB Lighting$378.00$0.00
48Subtotal PO-01811$756.00$0.00Subtotal PO-0181100
49
50PO-01815Maxlite, Inc.$791.75$0.00PO-01815Maxlite, Inc.$75.84$0.00
51Subtotal PO-01815$791.75$0.00Subtotal PO-01815$75.84$0.00
52
53PO-01817Feldman Brothers Electrical Supply Co.$233.40$0.00PO-01817Feldman Brothers Electrical Supply Co.$233.40$0.00
54Subtotal PO-01817$233.40$0.00Subtotal PO-01817$233.40$0.00
55
56PO-01821Louis T. Roselle Inc.$410.68$0.00PO-01821Louis T. Roselle Inc.$410.68$0.00
57Subtotal PO-01821$410.68$0.00Subtotal PO-01821410.680
58
59American Express$7,910.32$0.00
60Campbell Electric LLC$12,280.00$0.00
61Campbell Electric LLC$12,280.00$0.00
62EF Lighting Improvement LLC$4,400.00$0.00
63EF Lighting Improvement LLC$4,400.00$0.00
64EF Lighting Improvement LLC$4,400.00$0.00
65EF Lighting Improvement LLC$4,400.00$0.00
66Maxlite, Inc.$933.89$0.00
67Maxlite, Inc.$75.84$0.00
combine
Cell Formulas
RangeFormula
M4:N4,AA57:AB57,M57:N57,AA54:AB54,M54:N54,AA51:AB51,M51:N51,M44:N44,AA37:AB37,M37:N37,AA30:AB30,M30:N30,AA21:AB21,M21:N21,AA10:AB10,M10:N10,AA7:AB7,M7:N7,AA4:AB4M4=SUM(M3)
M18:N18,AA18:AB18M18=SUM(M12:M17)
M27:N27,AA27:AB27M27=SUM(M23:M26)
M34:N34,AA48:AB48,M48:N48,M41:N41,AA34:AB34M34=SUM(M32:M33)
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Better if you use Power Query as This is excel build-in feature and the speed will be many times higher than VBA.

VBA files may not support MAC.
 
Upvote 0
Hi Thewiseguy, I saw the job offer on Upwork, but I couldn't apply, I created the code in VBA you needed.
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,215,087
Messages
6,123,046
Members
449,092
Latest member
ikke

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