If this is part of a VBA application, then you could forego using WS formulas
TestFuncClose () just returns the Close for a date and time
TestFunc () returns a 4 element array for a date and time with the 4 parameters using a single search
Sub drv()
Dim A As Variant
With ActiveSheet
MsgBox TestFuncClose(.Cells(1, 1).CurrentRegion, .Range("K2"), .Range("K3"))
A = TestFunc(.Cells(1, 1).CurrentRegion, .Range("K2"), .Range("K3"))
MsgBox "Open = " & A(1)
MsgBox "High = " & A(2)
MsgBox "Low = " & A(3)
MsgBox "Close = " & A(4)
End With
End Sub
'3 = open, 4 = high, 5 = low, 6 = close
Function TestFuncClose(Rin As Range, Din As Date, Tin As Date) As Variant
Dim vData As Variant
Dim i As Long
TestFuncClose = CVErr(xlErrNA)
vData = Rin.CurrentRegion.CurrentRegion
For i = 2 To UBound(vData, 1)
If vData(i, 1) = Din And vData(i, 2) = Tin Then
TestFuncClose = vData(i, 6)
Exit Function
End If
Next
End Function
Function TestFunc(Rin As Range, Din As Date, Tin As Date) As Variant
Dim vData As Variant
Dim i As Long
Dim A(1 To 4) As Double
TestFunc = CVErr(xlErrNA)
vData = Rin.CurrentRegion.CurrentRegion
For i = 2 To UBound(vData, 1)
If vData(i, 1) = Din And vData(i, 2) = Tin Then
A(1) = vData(i, 3)
A(2) = vData(i, 4)
A(3) = vData(i, 5)
A(4) = vData(i, 6)
TestFunc = A
Exit Function
End If
Next
End Function