Macro Help - Copy paste based on Date

Steves73

Board Regular
Joined
Oct 19, 2016
Messages
173
Office Version
  1. 365
Platform
  1. Windows
Hi All

Need some help, apologies if the below a is a bit confusing

So, Need a macro that looks in column B, C, D. Matches the date on the rows 76, 81, 86. then copies the corresponding "Unit No" in Column A to the matched cell in rows 76, 78,86 (and so on) - Calendar will be for a year but got example sake I'm only showing March, April, May

Also, macro will then add to row 79, 84 89 and so on under "Unit No" the corresponding data in either B1,C1,D1,E1

Please note, information in Rows B,C,D and E and populated by Xlookup so automatic

More than happy to reformat to make it easier for the Macro

Any Help is much appreciated




1680330971760.png
 
The H$2 in B42 needs to be B40 (the date).

The H$2 in B43 needs to be B40 (the date).

Just drag the formula across.
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Yep, done that, tried dragging the formula from B74 to V74 and also copy and pasting, still same. Should we have a iserror then ""? Or am I doing something wrong?
 
Upvote 0
Yes, that is my fault in using dates that always match. Apologies.

Try this by surrounding the formula in a count of cells in names that contain the date.

=IF(COUNTIF(dates,H2)>0,INDEX(unitno,MATCH(1,MMULT(--(dates=H$2),TRANSPOSE(COLUMN(dates)^0)),0)),"")
 
Upvote 0
Solution
That works perfectly :)
Can i have the same for the "Service Type"
 
Upvote 0
=IF(COUNTIF(dates,H2)>0,OFFSET($A$1,0,MATCH(H$2,OFFSET($A$1:$E$1,MATCH(1,MMULT(--(dates=H$2),TRANSPOSE(COLUMN(dates)^0)),0),0),0)-1),"")

All I'm doing is wrapping the existing formula in :

IF(COUNTIF(dates,H2)>0, ******* , "")
 
Upvote 0
You have done extremely well, all working perfectly, Thank you so much. Really do appreciate you help :)
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,896
Members
452,948
Latest member
Dupuhini

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