Macro for Copy/Paste Value to current cell based on matching date

LexCorp

New Member
Joined
Apr 1, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Apologies in advance - I can't install XL2BB on my laptop due to company policies. I'll do my best to explain this as simple as possible.

I have a Workbook with 2 sheets. 1 sheet shows the daily results for each team members completed tasks - this information is pulled from Sheet 2 using COUNTIFS. Sheet 2 is the daily raw data (this gets updated daily and previous raw data is lost) and a single cell that is manually updated to show the date of the data sample.

Sheet 1

Name01/04/2102/04/21
Person 172 (from Formula)0 (formula awaiting Date above matching Sheet 2 C1)
Person 284 (from Formula)0 (formula awaiting Date above matching Sheet 2 C1)

Sheet 2

Raw DataDate of Data
101/04/21 (manually entered)
*Lots of raw data*
84

My Problem
When I update the raw data, then amend the date to, for example, 02/04/21, I lose the data in Sheet1 Cells B2&B3 as the new data is now in the column adjacent in C2&C3
Of course, I could simply Copy/Paste Values the data in Sheet 1 each time before I update my raw data, but between you and I, I have more sheets also doing the same for different people/depts - and this will take a long time!

Ideal solution
I'd like to create a macro button that will be used after I drop in the latest data and update the date in Sheet 2, that when pressed will perform the following:
IF date in Sheet 1 ROW1 = date in Sheet 2 C1, Copy then Paste Values in Sheet 1 that has matching date Column for X number of rows (in example above - 2 rows)

I apologise profusely if this explanation sucks. I can answer more questions if it helps?

Also, the title of this thread sucks - was a nightmare trying to figure out how to explain it 😩
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

LexCorp

New Member
Joined
Apr 1, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Ok, I've managed to replicate at home basically what is happening and added it via XL2BB below

Book1
ABCDEF
1Team 101-Apr-2102-Apr-2103-Apr-2104-Apr-21
2Person 12000
3Person 22000
4Average2000
5
6Team 201-Apr-2102-Apr-2103-Apr-2104-Apr-21
7Person 31000
8Person 43000
9Average2000
10
11
Sheet1
Cell Formulas
RangeFormula
B2:E3,B7:E8B2=IF(B$1=Sheet2!$D$2,COUNTIFS(Sheet2!$A:$A,Sheet1!$A2,Sheet2!$B:$B,"Job 1"),)
B4:E4,B9:E9B4=AVERAGE(B2:B3)



Book1
ABCDE
1NameTypeManual Date
2Person 1Job 101-Apr-21
3Person 1Job 2
4Person 1Job 3
5Person 1Job 4
6Person 1Job 1
7Person 1Job 2
8Person 2Job 3
9Person 2Job 4
10Person 2Job 1
11Person 2Job 2
12Person 2Job 3
13Person 2Job 4
14Person 2Job 1
15Person 2Job 2
16Person 2Job 3
17Person 3Job 4
18Person 3Job 1
19Person 3Job 2
20Person 3Job 3
21Person 4Job 4
22Person 4Job 1
23Person 4Job 2
24Person 4Job 3
25Person 4Job 1
26Person 4Job 2
27Person 4Job 1
28Person 4Job 2
29Person 4Job 3
30Person 4Job 4
Sheet2
 

LexCorp

New Member
Joined
Apr 1, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Is there anybody out there :alien:? Still struggling with this one so if anyone can chime in, would be really grateful. I've tried to get some support from our internal company forum, but no one seems to be able to help. Thanks in advance.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,361
Messages
5,635,812
Members
416,884
Latest member
leeshjay

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
Top