Not difficult - Consolidation of sheets

mickeystanford_alumni

Board Regular
Joined
May 11, 2022
Messages
129
Office Version
  1. 2021
Platform
  1. Windows
  2. MacOS
Hi everyone,
Hope you are having a good day.
I am facing an issue as I am not a vba expert with my coding when trying to tell excel to do the below:

I have 2 sheets that I want to merge on a weekly basis: Table 1 and Table 2.
The format is simple as both tables have the same headers.

What I want excel to tell is:
1. Copy all rows from table 1 and table 2 into a new sheet.
2. If "column A" from table 1 and table 2 match, (e.g. as below CCCC), then ONLY paste the row from table 2 (as it is more reliable for me).
3. As I will be doing this on a weekly basis, the week after I would just like to paste the new information below my tables 1 and 2, and then update the Matrix accordingly. I believe the coding for the first 2 points will take that into account (just in case).
4. For this 3rd point, an issue I might be facing is that maybe Product FFFF which today it was reported to have sales in Month APR, next week, I receive information than it is not APR but MAY. Then in that case, I would like to keep the MAY and delete the APR. Then, to keep the newest...this might be tricky...if any ideas then that would be a killer.

Thank you so much to everyone who could help me.
TABLE 1 TABLE 2
PRODUCTSALESMONTHPRODUCTSALESMONTH
AAAA1,000APRFFFF50APR
BBBB1,000APRGGGG50APR
CCCC1,000APRCCCC2,000APR
DDDD1,000APR

CONSOLIDATED
PRODUCTSALESMONTH
AAAA1,000APR
BBBB1,000APR
CCCC2,000APR
FFFF50APR
GGGG50APR
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi, I have a similar kind which is showing below but through simple vlookup formula not VBA.
May be this may help you.

Mr. Excel.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAA
1VolumeSalesCostProfitProductAreaMonthVolumeSalesCostProfit
2PrimaryProductAreaJanFebMarJanFebMarJanFebMarJanFebMar
3ABLACKABLACK20030015119,00028,50014,3452,5007,5003,77516,50021,00010,570ABLACKJan20019,0002,50016,500
4BBLACKBBLACK22031517120,90029,92516,2453,0007,8754,27517,90022,05011,970BBLACKJan22020,9003,00017,900
5CREDCRED24033019122,80031,35018,1453,5008,2504,77519,30023,10013,370CREDJan24022,8003,50019,300
6EGREENEGREEN26034521124,70032,77520,0454,0008,6255,27520,70024,15014,770EGREENJan26024,7004,00020,700
7DGREENDGREEN28036023126,60034,20021,9454,5009,0005,77522,10025,20016,170DGREENJan28026,6004,50022,100
8ABLUEABLUE30037525128,50035,62523,8455,0009,3756,27523,50026,25017,570ABLUEJan30028,5005,00023,500
9AGREENAGREEN32039027130,40037,05025,7455,5009,7506,77524,90027,30018,970AGREENJan32030,4005,50024,900
10Total1,8202,4151,477172,900229,425140,31528,00060,37536,925144,900169,050103,390ABLACKFeb30028,5007,50021,000
11417,340BBLACKFeb31529,9257,87522,050
12CREDFeb33031,3508,25023,100
13EGREENFeb34532,7758,62524,150
14DGREENFeb36034,2009,00025,200
15ABLUEFeb37535,6259,37526,250
16AGREENFeb39037,0509,75027,300
17ABLACKMar15114,3453,77510,570
18BBLACKMar17116,2454,27511,970
19CREDMar19118,1454,77513,370
20EGREENMar21120,0455,27514,770
21DGREENMar23121,9455,77516,170
22ABLUEMar25123,8456,27517,570
23AGREENMar27125,7456,77518,970
24417,340
Horizontal to vertical
Cell Formulas
RangeFormula
P3:R9P3=+H3-L3
L10:N10,H10:J10,D10:F10,P10:R10P10=SUM(P3:P9)
W3:W23W3=VLOOKUP(($T3&$U3),$A$3:$R$10,IF($V3="Jan",4,IF($V3="Feb",5,6)),FALSE)
X3:X23X3=VLOOKUP(($T3&$U3),$A$3:$R$10,IF($V3="Jan",8,IF($V3="Feb",9,10)),FALSE)
Y3:Y23Y3=VLOOKUP(($T3&$U3),$A$3:$R$10,IF($V3="Jan",12,IF($V3="Feb",13,14)),FALSE)
A3:A9A3=B3&C3
R11R11=+R10+P10+Q10
Z3:Z23Z3=VLOOKUP(($T3&$U3),$A$3:$R$10,IF($V3="Jan",16,IF($V3="Feb",17,18)),FALSE)
Z24Z24=SUM(Z3:Z23)
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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