I am trying to use the worksheetfunction.vlookup to work. I have a sheet with 2 columns, column 1 has dates in mm/dd/yyyy format, column 2 has 5 decimal numbers. below is the function & cell entry I use to call it. I have two questions:
1. I get the error 1004 unable to get the vlookup property...
2. when I begin typing the function into the cell, none of the agruements appear in the intellisense. Any help will be appreciated
=ReturnCalcTest(a10,a2,$a1:$b80)
Public Function ReturnCalcTest(EndDate As Date, BeginDate As Date, LookupRange As Range) As Double
Dim UVe, UVb As Double
Dim i As Integer
i = DateDiff("yyyy", EndDate, BeginDate)
UVe = Application.WorksheetFunction.VLookup(EndDate, LookupRange, 2, False)
UVb = Application.WorksheetFunction.VLookup(BeginDate, LookupRange, 2, False)
If i < 1 Then
ReturnCalcTest = ((UVe / UVb) - 1) * 100
Else
ReturnCalcTest = (((UVe / UVb) ^ (1 / i)) - 1) * 100
End If
End Function
Moderators Note: Please follow Forum Rule #3 and use code tags. Added this time, but please use them in the future…Thanks.
Bookmarks