Ref Reverse Lookup in VBA

chihuahua

New Member
Joined
May 2, 2013
Messages
17
In video MrExcel & Excelisfun Trick 7, a Function uses dates and times for listing Truck appointments. The dates work fine but the time only works when entered as text. Is that true for all time procedures ?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Thanks for your response but no that doesn't help. When the VBA function in run the time shows up as a decimal (8:00 AM shows up as .3333333),unless the time is entered as text , '8:00 AM. The decimal is not converted to a time like the date serial number is converted to a date. Formatting the cell doesn't change the decimal either.
 
Upvote 0
this is the table: Results go here:

11/19/08 11/20/08 11/21/08 Truck Appointment
8:00 AM Truck1 Truck4 Truck9
9:00 AM Truck8 Truck5 Truck1 Truck1 11/19/08 8:00 AM; 11/21/08 9:00 AM <-- This is result but when time is entered as a time not as text (')the
10:00 AM Truck9 Truck11 Truck5 Truck2 result is shown as decimal (.33333333 for 8:00 AM and .375
11:00 AM Truck6 Truck4 Truck2 Truck3 for 9:00 AM).. The dates are fine. They calculate perfectly.
Truck4
Truck5
Truck6
Truck7
Truck8
Truck9
Truck10
Truck11
The code:
Function RL(truckvalue as range,lookuptable as range)
hrow = lookuptable.rows(1).row-1
hcol = lookuptable.columns(1).column-1
RL = ""
for each cell in lookuptable
if cell.value=truckvalue.value then
RL = RL & cells(hrow,cell.column).value & " " & cells(cell.column,hcol).value & ";"
end if
next cell
End function

All of this in straight from Dueling Excel with MrExcel & Excelisfun episode Reverse Lookup (trick #7)

sorry this didn't turn out.. Wont let me paste it from excel (2010)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,222,014
Messages
6,163,392
Members
451,834
Latest member
tomtownson

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