VBA code to table the data based on Weekending-date and names

Wafee

Board Regular
Joined
May 27, 2020
Messages
104
Office Version
  1. 2013
Platform
  1. Windows
Can someone help me with a VBA code for below requirement please.

I have a data in Source sheet that has weekending date, Sales Amount, Senior Manage and Manager as below. let us say the below data is in source sheet of the current workbook. Source sheet have data from previous week also. I have filtered and given the current weeks data alone.

Column AColumn DColumn HColumn I
WEEK_END_DATESalesSenior ManagerManager
10/17/2020
40​
HariMax
10/17/2020
30​
SamJames
10/17/2020
60​
HariMax
10/17/2020
10​
HariColin
10/17/2020
20​
HariJade
10/17/2020
40​
SamVarun
10/17/2020
50​
SamJames
10/17/2020
70​
SamMurat

We have another sheet as output which is as below which is from previous week. now if we chnage report date to - 10/17/2020 and run then code has to do the below steps.

ABCDY
Senior Manager/Manager10/3/202010/10/202010/17/2020Report date
Hari806010/10/2020
Max4040
Colin4020
Sam9080
Varun2030
James2020
Murat3020
Jade2010

1. once date is chnaged in Report date column to 10/17/2020, it has to filter the same in the weekending column in source sheet.
2. it has to check whether there is any change in terms of Managers under Senior Managers. in the above case (Jade has been moved from Sam to Hari)
3. if there is a new addition under Senior Manager then that new name to be inserted below Senior Manager.
4. It has to be pick the right column to publish the values which can be done by looking in to first row data to find the date that matches with Report Date in "Y" Column.
4. now it has to be publish the sales amount based on the Date and Name and sales column.

final output looks as below. no need to remove jade from Sam as it got some data from previous week.

Senior Manager/Manager10/3/202010/10/202010/17/2020Report date
Hari806013010/17/2020
Max4040100
Colin402010
Jade20
Sam9080190
Varun203040
James202080
Murat302070
Jade2010

In my sheet Senior Managers Name will be in bold to differentiate. Thank you in advance.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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