A
alexcn
Hi Everyone,
I am trying to find the nearest datetime after a range of values in a
lookup table using Excel VBA. I have tried the various
WorksheetFunction.Match and WorksheetFunction.V[H]Lookup functions but
these (for "nearest" values" depend on the searchable data being
sorted, which I cant guarantee. I have also tried the various
Range.Find and Cells.Find methods again to no avail. I have tried
converting the datetime to serial format, mm/dd/yyyy hh:mm:ss both
before and after passing the value to a UDF but still it returns
nothing. I realise this is something a lot of people have trouble
with, but was wondering if anyone had any pointers. My data range is
as follows, sorted for the purpose of this post but by definition it
wont be sorted in real life:
DateTime
23/03/2010 15:22
23/03/2010 15:58
23/03/2010 16:04
23/03/2010 16:17
23/03/2010 16:23
23/03/2010 16:37
23/03/2010 16:51
23/03/2010 17:01
23/03/2010 17:08
23/03/2010 20:38
Thanks to anyone that can offer some assistance,
Alex
I am trying to find the nearest datetime after a range of values in a
lookup table using Excel VBA. I have tried the various
WorksheetFunction.Match and WorksheetFunction.V[H]Lookup functions but
these (for "nearest" values" depend on the searchable data being
sorted, which I cant guarantee. I have also tried the various
Range.Find and Cells.Find methods again to no avail. I have tried
converting the datetime to serial format, mm/dd/yyyy hh:mm:ss both
before and after passing the value to a UDF but still it returns
nothing. I realise this is something a lot of people have trouble
with, but was wondering if anyone had any pointers. My data range is
as follows, sorted for the purpose of this post but by definition it
wont be sorted in real life:
DateTime
23/03/2010 15:22
23/03/2010 15:58
23/03/2010 16:04
23/03/2010 16:17
23/03/2010 16:23
23/03/2010 16:37
23/03/2010 16:51
23/03/2010 17:01
23/03/2010 17:08
23/03/2010 20:38
Thanks to anyone that can offer some assistance,
Alex