vlookup time help. Urgent! Thanks!

nkagar2

New Member
Joined
Apr 11, 2014
Messages
7
Hello - I am trying the vlookup to categorize time into periods. However I am unable to format the lookup value time into hh:mm:ss. As a result I am getting #nA error. Please help me. This is time sensitive for me!!!

Main issue: When the data is imported, we receivetime as a text value (eg. 64539 instead of 06:45:39) also the period range entered are text values. When I convert both into hh:mm:ss it results #n/a error. However if I just type in the time 06:45:39 then it will retrieve the correct result. Please help.


Time RangePeriod
64856 070000 AM
090000AM-OFF
110000NOON
130000PM-OFF
160000PM

<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>
</tbody>



=VLOOKUP(A2,B2:C6,2,TRUE) results in #n/A
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You're getting N/A not because the formula is wrong, but because 64856 is below the lowest value in your table, 70000. Lower that number to an earlier value, or add a new line at the top of your table to cover the "out of bounds" time.


Excel 2010
ABCDEF
1TimeRangePeriod
2648560Too EarlyToo Early
370000AM
490000AM-OFF
5110000NOON
6130000PM-OFF
7160000PM
Sheet1
Cell Formulas
RangeFormula
F2=VLOOKUP(A2,B2:C7,2,TRUE)
 
Upvote 0
Hi
Using True in vlookup looks for an exact match and failing that it looks for the largest value that is less than the lookup value.
In this case it's looking for a value in the data range less than 64856, which you don't have, and so is throwing up an #N/A.
To remedy this you need to insert cells under Range and Period, as below, to represent times less than 07:00 and amend the vlookup data range as necessary to include the additional cells.

TimeRangePeriod
648560PM
070000AM
090000AM-OFF
110000NOON
130000PM-OFF
160000PM

<tbody>
</tbody>


Hope this helps!

EDIT - sorry, I didn't see the earlier reply whilst I was typing.
 
Last edited:
Upvote 0
OH my goodness!!! I'm sooo embarrassed to have asked such a stupid question! Thank you all for your time and help. I appreciate it. Thanks again! :)


Hi
Using True in vlookup looks for an exact match and failing that it looks for the largest value that is less than the lookup value.
In this case it's looking for a value in the data range less than 64856, which you don't have, and so is throwing up an #N/A.
To remedy this you need to insert cells under Range and Period, as below, to represent times less than 07:00 and amend the vlookup data range as necessary to include the additional cells.

TimeRangePeriod
648560PM
070000AM
090000AM-OFF
110000NOON
130000PM-OFF
160000PM

<tbody>
</tbody>


Hope this helps!

EDIT - sorry, I didn't see the earlier reply whilst I was typing.
 
Upvote 0

Forum statistics

Threads
1,214,638
Messages
6,120,674
Members
448,977
Latest member
moonlight6

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