G Marshall
Board Regular
- Joined
- Dec 31, 2002
- Messages
- 134
Hello
I have a problem with a VLOOKUP formula and I would appreciate some help. I have searched through other VLOOKUP questions but I have been unable to find a satisfactory answer.
Cell A1 Format Time [h]:mm
Cell B1 Format Number 2 Decimal places and has the formula =HOUR(A1)+(MINUTE(A1)/60) This returns the time value in A1 converted to a decimal.
Cell C1 Format Number 2 Decimal places and has the VLOOKUP formula
=IF(ISNUMBER(B1),VLOOKUP(B1,{3.75,0.5;3.5,0.5;3.66,0.5},2,0),"")
In Cell A1 if I enter 3:45 or 3:30 then 0.5 appears in Cell C1 which is correct, however when I enter 3:40 in Cell A1 the #N/A appears in Cell C1.
I think the problem lies with the fact that 3:30 in time converts exactly to 3.50 in decimal and 3:45 in time converts exactly to 3.75 in decimal but 3:40 converts to 3.6666667 infinite , and is not returning an exact match of 3.66 even though I have the cell formatted to 2 decimal places.
How can I get around this problem in my VLOOKUP formula, I would appreciate some help.
Thanks
Gerald
I have a problem with a VLOOKUP formula and I would appreciate some help. I have searched through other VLOOKUP questions but I have been unable to find a satisfactory answer.
Cell A1 Format Time [h]:mm
Cell B1 Format Number 2 Decimal places and has the formula =HOUR(A1)+(MINUTE(A1)/60) This returns the time value in A1 converted to a decimal.
Cell C1 Format Number 2 Decimal places and has the VLOOKUP formula
=IF(ISNUMBER(B1),VLOOKUP(B1,{3.75,0.5;3.5,0.5;3.66,0.5},2,0),"")
In Cell A1 if I enter 3:45 or 3:30 then 0.5 appears in Cell C1 which is correct, however when I enter 3:40 in Cell A1 the #N/A appears in Cell C1.
I think the problem lies with the fact that 3:30 in time converts exactly to 3.50 in decimal and 3:45 in time converts exactly to 3.75 in decimal but 3:40 converts to 3.6666667 infinite , and is not returning an exact match of 3.66 even though I have the cell formatted to 2 decimal places.
How can I get around this problem in my VLOOKUP formula, I would appreciate some help.
Thanks
Gerald