ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   application.vlookup syntax (https://www.excelbanter.com/excel-programming/378441-application-vlookup-syntax.html)

[email protected]

application.vlookup syntax
 
Hello,

I'm having trouble with the following piece of code -- it returns "0"
as startprice when it should not. I'm pretty sure the vlookup is not
working properly.

Any help is appreciated.

thanks,
rob

Function returnclose(numdays As Integer) As Long
' calculates return over period indicated by date entered and days in
left hand column
Dim startdate As Date
Dim startprice As Long
Dim enddate As Date
Dim endprice As Long

startdate = Range("startdate").Value
startprice = Application.VLookup(startdate, Range("OPWV_prices"),
2, False)


Dave Peterson

application.vlookup syntax
 
Since it's returning a 0, I think I'd check the data one more time. Maybe that
date appears early in the table, but on a hidden row?

wrote:

Hello,

I'm having trouble with the following piece of code -- it returns "0"
as startprice when it should not. I'm pretty sure the vlookup is not
working properly.

Any help is appreciated.

thanks,
rob

Function returnclose(numdays As Integer) As Long
' calculates return over period indicated by date entered and days in
left hand column
Dim startdate As Date
Dim startprice As Long
Dim enddate As Date
Dim endprice As Long

startdate = Range("startdate").Value
startprice = Application.VLookup(startdate, Range("OPWV_prices"),
2, False)


--

Dave Peterson


All times are GMT +1. The time now is 02:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com