Hello All,
I am working on a file via which i wanted to check if someone is going on leave then i would have to compare his OnCall schedule and check if the OnCall and Vacation are at same time, if not i should send an email stating same.
While working on this i am using "=ISNUMBER(MATCH(1,INDEX((('SUN EMEA'!C:C=A2)+('SUN EMEA'!E:E=A2))*(('SUN EMEA'!A:A>=B2)*('SUN EMEA'!A:A<=C2)+('SUN EMEA'!A:A<=B2)*('SUN EMEA'!B:B>=B2)),0),0))" where SUN EMEA is on of 7 oncall schedule i have. I have predefined roster for all so we know which sheet we have to compare the roster.
I tried writing the code however seems like i am making a mistake as i am not getting the right result when Macro is running whereas if i implement the formula it give me correct result. Below is the code i am running.
Sub vacation_check()
Dim i As Integer
For i = 300 To 303
If Cells(i, 11) = "SUN AMER" Then
Cells(i, 12) = "=ISNUMBER(MATCH(1,INDEX((('SUN AMER'!C:C= cells(i,1))+('SUN AMER'!E:E=cells(i,1)))*(('SUN AMER'!A:A>=cells(i,2))*('SUN AMER'!A:A<=cells(i,3))+('SUN AMER'!A:A<=cells(i,2))*('SUN AMER'!B:B>=cells(i,2))),0),0))"
ElseIf Cells(i, 11) = "SUN EMEA" Then
Cells(i, 12) = "=ISNUMBER(MATCH(1,INDEX((('SUN EMEA'!C:C=cells(i,1))+('SUN EMEA'!E:E=cells(i,1)))*(('SUN EMEA'!A:A>=cells(i,2))*('SUN EMEA'!A:A<=cells(i,3))+('SUN EMEA'!A:A<=cells(i,2))*('SUN EMEA'!B:B>=cells(i,2))),0),0))"
ElseIf Cells(i, 11) = "SUN APJ" Then
Cells(i, 12) = "=ISNUMBER(MATCH(1,INDEX((('SUN APJ'!C:C=cells(i,1))+('SUN APJ'!E:E=cells(i,1)))*(('SUN APJ'!A:A>=cells(i,2))*('SUN APJ'!A:A<=cells(i,3))+('SUN APJ'!A:A<=cells(i,2))*('SUN APJ'!B:B>=cells(i,2))),0),0))"
End If
Next
End Sub
Any help on this would appreciated. I have attached the file for reference.