VBA Holiday Dates by Week End Date

Finalfight40

Active Member
Joined
Apr 24, 2018
Messages
273
Office Version
  1. 365
Platform
  1. Windows
Hi All

I'm not sure if something like this is possible so i thought i'd ask.

Currently we have a system where we store our holiday dates and we need to update another spreadsheet from this but it is not exported in a friendly fashion for this.

Please see below as i have a description of each column and a desired result.

I have 5 columns which i am interested in A to E (the rest will be deleted)

Column A - Persons Name
Column B - Start Date
Column C - End Date
Column D - Vacation
Column E - Note (If this field is populated, then the vacation will be half a day, otherwise it will be a full day)

The data would need to be organised by week end date (the Friday). Below i have used an example based on this week and next week.

How the data is exported:

Assigned ToStart DateEnd DateVacationNote
Andy28/05/201828/05/2018x
Andy30/05/201831/05/2018x
Bob29/05/201831/05/2018x
Lucy28/05/201828/05/2018xPM ONLY
Peter31/05/201801/06/2018x
Peter04/06/201805/06/2018x

<tbody>
</tbody>


Desired Result (on a new sheet):

01 June 201808 June 2018
AndyMonday, Wednesday, Thursday
BobTuesday, Wednesday, Thursday
LucyMonday (Half Day)
PeterThursday, FridayMonday, Tuesday

<tbody>
</tbody>


Would it be possible to get something that could resemble this?

Thank you in advance for taking your time to read this.
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Assigned ToStart DateEnd DateVacationNotedaysstart dayend day
Andy28/05/201828/05/2018x1MonMon
Andy30/05/201831/05/2018x2WedThu
Bob29/05/201831/05/2018x3TueThuDesired Result (on a new sheet):
Lucy28/05/201828/05/2018xPM ONLY0.5MonMon
Peter31/05/201801/06/2018x2ThuFri01-Jun-1808-Jun-18
Peter04/06/201805/06/2018x2MonTueAndyMonday, Wednesday, Thursday
BobTuesday, Wednesday, Thursday
LucyMonday (Half Day)
PeterThursday, FridayMonday, Tuesday
this offset look up table deals only with 5 days max in a session
end day
montuewedthufri
monmonmon, tuemon, tue, wedmon, tue, wed, thumon, tue, wed, thu, fri
start daytuetue, wed, thu, fri, montuetue, wedtue, wed, thutue, wed, thu, fri
wedwed, thu, fri, monwed, thu, fri, mon, tuewedwed, thuwed, thu, fri
thuthu, fri, monthu, fri, mon, tuethu, fri, mon, tue, wedthuthu, fri
frifri, monfri, mon, tuefri, mon, tue, wedfri, mon, tue, wed, thufri
Andymon
Andywed, thu
Bobtue, wed, thu
Lucymon
Peterthu, fri
Petermon, tue
Andymon
Andywed, thu, mon
Bobtue, wed, thu
Lucymon
Peterthu, fri
Petermon, tue, thu, fri
using helpers I got close to what you want…
not sure how to mark the half day

<colgroup><col><col><col><col span="5"><col><col span="9"></colgroup><tbody>
</tbody>
 
Upvote 0
Assigned ToStart DateEnd DateVacationNotedaysstart dayend day
Andy28/05/201828/05/2018x1MonMon
Andy30/05/201831/05/2018x2WedThu
Bob29/05/201831/05/2018x3TueThuDesired Result (on a new sheet):
Lucy28/05/201828/05/2018xPM ONLY0.5MonMon
Peter31/05/201801/06/2018x2ThuFri01-Jun-1808-Jun-18
Peter04/06/201805/06/2018x2MonTueAndyMonday, Wednesday, Thursday
BobTuesday, Wednesday, Thursday
LucyMonday (Half Day)
PeterThursday, FridayMonday, Tuesday
this offset look up table deals only with 5 days max in a session
end day
montuewedthufri
monmonmon, tuemon, tue, wedmon, tue, wed, thumon, tue, wed, thu, fri
start daytuetue, wed, thu, fri, montuetue, wedtue, wed, thutue, wed, thu, fri
wedwed, thu, fri, monwed, thu, fri, mon, tuewedwed, thuwed, thu, fri
thuthu, fri, monthu, fri, mon, tuethu, fri, mon, tue, wedthuthu, fri
frifri, monfri, mon, tuefri, mon, tue, wedfri, mon, tue, wed, thufri
Andymon
Andywed, thu
Bobtue, wed, thu
Lucymon
Peterthu, fri
Petermon, tue
Andymon
Andymon, wed, thu
Bobtue, wed, thusilly error corrected
Lucymon
Peterthu, fri
Peterthu, fri, mon, tue
using helpers I got close to what you want…
not sure how to mark the half day

<colgroup><col><col><col><col span="5"><col><col span="9"></colgroup><tbody>
</tbody>
 
Upvote 0
Hi Brew

Thank you for taking the time to have a look at this problem.

I have no problem using helper columns when it comes to this.

The half day i can live without as they are so rare that they could be typed in manually.

If you could let me know how you were able to get this, i would greatly appreciate it.
 
Upvote 0
***'d ToStartEnd DateVacNotedaysstart dayend day
Andy28/05/201828/05/2018x1MonMon
Andy30/05/201831/05/2018x2WedThu
Bob29/05/201831/05/2018x3TueThu
Lucy28/05/201828/05/2018xPM ONLY0.5MonMon
Peter31/05/201801/06/2018x2ThuFri
Peter04/06/201805/06/2018x2MonTue
ABCDEFGHIJKLMNOPQR
this offset look up table deals only with 5 days max in a session
end day
row 15 montuewedthufri
monmonmon, tuemon, tue, wedmon, tue, wed, thumon, tue, wed, thu, fri
start daytuetue, wed, thu, fri, montuetue, wedtue, wed, thutue, wed, thu, fri
wedwed, thu, fri, monwed, thu, fri, mon, tuewedwed, thuwed, thu, fri
thuthu, fri, monthu, fri, mon, tuethu, fri, mon, tue, wedthuthu, fri
frifri, monfri, mon, tuefri, mon, tue, wedfri, mon, tue, wed, thufri
row 26Andymon
Andywed, thu
Bobtue, wed, thu
Lucymon
Peterthu, fri
Petermon, tue
Andymon
row 35Andymon, wed, thu
Bobtue, wed, thusilly error corrected
Lucymon
Peterthu, fri
Peterthu, fri, mon, tue
the mon in H2 comes from
=TEXT(B2,"ddd")
the mon in I2 comes from
=IF(OR(E2<>"",C2=B2),H2,TEXT(C2,"ddd"))
the mon in H26 comes from
=OFFSET($K$15, MATCH(H2,$K$16:$K$20,0),MATCH(I2,$L$15:$P$15,0))
the mon, wed, thu in H35 comes from
=IF(G35=G34,H26&", "&H27,H27)
may be alter the formula so that for example H5
( the Monday start day for Lucy)
to
=IF(E5<>"",TEXT(B5,"ddd")&" "&E5,TEXT(B5,"ddd"))

<colgroup><col><col><col><col span="2"><col><col><col span="3"><col><col><col><col><col><col><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
Interesting.

I will test this out soon but from what i can see, i think i can work with this. It will definitely make the long manual job a lot shorter and easier to work with.

Thank you for taking a look and coming back to me, i know it wasn't a quick 1 line answer but i was honestly stumped as to what path i should be looking at.

I appreciate it.
 
Upvote 0
I am 72 and it is essential to keep my brain exercised !!! Glad to help - come back if there are issues,.,.,.,.
 
Upvote 0

Forum statistics

Threads
1,215,347
Messages
6,124,421
Members
449,157
Latest member
mytux

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