0% found this document useful (0 votes)
48 views2 pages

Function Var Hols Dim As Object Dim Long Set

The function takes in start date, end date, and an array of holidays. It iterates through the holidays array, checks if each holiday date falls between the start and end dates, and counts the number of days. It returns a string with the holiday names and counts, or returns "0 holiday" if none.

Uploaded by

Andrew Wu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views2 pages

Function Var Hols Dim As Object Dim Long Set

The function takes in start date, end date, and an array of holidays. It iterates through the holidays array, checks if each holiday date falls between the start and end dates, and counts the number of days. It returns a string with the holiday names and counts, or returns "0 holiday" if none.

Uploaded by

Andrew Wu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Function HolNotes(dStart, dEnd, Hols)

var H = Hols
Dim d As Object
Dim i As Long
Set d = CreateObject("scripting.dictionary")
H = Hols.Value
i;
For i = 1 To UBound(H)
If H(i, 2) >= dStart And H(i, 2) <= dEnd Then
If d.exists(H(i, 1)) Then
d.Item(H(i, 1)) = d.Item(H(i, 1)) + 1
Else
d.Add H(i, 1), 1
End If
End If
Next i
If d.Count > 0 Then
For i = 1 To d.Count
HolNotes = HolNotes & ", " & d.Items()(i - 1) & " day(s) of " & d.Keys()
(i - 1)
Next i
HolNotes = Mid(HolNotes, 3)
Else
HolNotes = "0 holiday"
End If
End Function

-----------------------Function holNotes (startDate, endDate, holidays) {


Var startDate, endDate, i
Var holidays = SpreadsheetApp.getActiveSheet().getDataRange().getValues();
for (i = 0; holidays; i++) {
If(holidays[i][1] >= startDate && holidays[i][1] <= endDate) {
holidays.getSheetByName([i][0]) = d.getSheetByName(H[i]) + 1
}
Else {
d.insert H[i];
}
}
break;
}
If(d.sourceSheet.getDataRange() > 0) {
for (i = 1; i < d.sourceSheet.getDataRange(); i += 1) {
HolNotes = HolNotes + ", " + d.getSheetByName([i - 1]) + " day(s) of " + d.keys()(i 2)
break;
}
HolNotes = HolNotes.substring(3);
} else {
HolNotes = "0 holiday"

}
var holidays, i;
holidays = [
['New year 2016', '1/1/2016'],
['Lunar new year 2016' , '5/2/2016']
]
for(i = 0; i < holidays.length; i++) {
if (holidays[i][1] >= startDate && holidays[i][1] <= endDate) {
// implement goes here
}
}

You might also like