VLookup to Table with Dates

rbeaslin

New Member
Joined
Oct 30, 2008
Messages
16
Office Version
  1. 365
Platform
  1. Windows
I am trying to read from a table filled with dates and percentages. The trouble i am having is that when I do the application.vlookup it doesn't look up the value correctly when the range I select is in the table. I copied the values to a separate range on the worksheet (not in a table) and then the vlookup works as expected. Both the date in the table and in the range on the worksheet are formatted as short date.

Relevant items are below:
Dim RRR As Range
Set RRR = Sheets("data").Range("$a$2:$c$13")

iRate = Application.WorksheetFunction.VLookup(passvalue, RRR, 2)

VBA brings the date i'm looking for from a date-picker form as a date variable.

Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
passvalue = DateClicked
Me.Hide
End Sub

In declarations for module:
Option Explicit

Public passvalue As date


I have re-Dimed the variables as strings and variant and the table vlookup still doesn't work. I am getting Error 1004 on exiting my error handler and i can see its not finding a match in the vlookup.

Any help you could lend would be greatly appreciated.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
As i continued to research this, I was able to find this site which explained my issue so well. Hopefully it will help others.


Thanks!
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,392
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top