+ Reply to Thread
Results 1 to 5 of 5

Referencing Time in Excel

  1. #1
    Registered User
    Join Date
    12-19-2005
    Posts
    2

    Question Referencing Time in Excel

    We have discovered a problem in referencing time using the LOOKUP function and I haven't been able to resolve it using VLOOKUP or the INDEX and MATCH combination

    The easiest way to demonstrate the problem is to creat a list of times from 10:00 am to 12:00 pm in 15 minute increments, then copy the list into the adjacent column and convert that list into the decimal equivalent. See below for what the list should look like. I expanded the decimals to the maximum number of decimals.

    10:00 0.416666666666667
    10:15 0.427083333333333
    10:30 0.437500000000000
    10:45 0.447916666666667
    11:00 0.458333333333333
    11:15 0.468750000000000
    11:30 0.479166666666667
    11:45 0.489583333333333
    12:00 0.500000000000000

    Now if you write a formula using LOOKUP or VLOOKUP to try to return the decimal equivalent of a time in the left column. It works fine except at a few times like 10:45 and 11:30 when it returns the values for 10:30 and 11:15 respectively.

    Any help would be appreciated.

    Jeff

  2. #2
    Bob Phillips
    Guest

    Re: Referencing Time in Excel

    Both LOOKUP and VLOOKUP work okay for me in my (maybe limited) tests.

    What data are you comparing, a time string or time value, and what formula
    are you using.

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "jjhmbh" <[email protected]> wrote in
    message news:[email protected]...
    >
    > We have discovered a problem in referencing time using the LOOKUP
    > function and I haven't been able to resolve it using VLOOKUP or the
    > INDEX and MATCH combination
    >
    > The easiest way to demonstrate the problem is to creat a list of times
    > from 10:00 am to 12:00 pm in 15 minute increments, then copy the list
    > into the adjacent column and convert that list into the decimal
    > equivalent. See below for what the list should look like. I expanded
    > the decimals to the maximum number of decimals.
    >
    > 10:00 0.416666666666667
    > 10:15 0.427083333333333
    > 10:30 0.437500000000000
    > 10:45 0.447916666666667
    > 11:00 0.458333333333333
    > 11:15 0.468750000000000
    > 11:30 0.479166666666667
    > 11:45 0.489583333333333
    > 12:00 0.500000000000000
    >
    > Now if you write a formula using LOOKUP or VLOOKUP to try to return the
    > decimal equivalent of a time in the left column. It works fine except
    > at a few times like 10:45 and 11:30 when it returns the values for
    > 10:30 and 11:15 respectively.
    >
    > Any help would be appreciated.
    >
    > Jeff
    >
    >
    > --
    > jjhmbh
    > ------------------------------------------------------------------------
    > jjhmbh's Profile:

    http://www.excelforum.com/member.php...o&userid=29748
    > View this thread: http://www.excelforum.com/showthread...hreadid=494626
    >




  3. #3
    Registered User
    Join Date
    12-19-2005
    Posts
    2
    I am using LOOKUP and use the time value.

    Also I am referencing the time outside of the array. If I reference the time in the array, it returns the correct value. For instance, if you use the array below

    <A> <B> <C>
    11:00 1 11:30
    11:15 2
    11:30 3
    11:45 4
    12:00 5

    The formula LOOKUP(A3, A1:B5) returns 3
    But if you reference the value outside of the table, say in cell C1, the formula returns 2.

  4. #4
    Nick Hodge
    Guest

    Re: Referencing Time in Excel

    It's the rounding at all those decimal places that is causing the
    issue...try using the ROUND function on you lookup times, say to 6 decimals
    and then wrap the looked up value in a ROUND function too using the same
    decimals,like

    =VLOOKUP(ROUND(A1,6),Sheet1!$A$1:$B$24,2,FALSE)

    Using a little trial and error you will only be losing precision in seconds
    or probably milliseconds.

    One way at least if that precision is not necessary

    --
    HTH
    Nick Hodge
    Microsoft MVP - Excel
    Southampton, England
    www.nickhodge.co.uk
    [email protected]HIS


    "jjhmbh" <[email protected]> wrote in
    message news:[email protected]...
    >
    > We have discovered a problem in referencing time using the LOOKUP
    > function and I haven't been able to resolve it using VLOOKUP or the
    > INDEX and MATCH combination
    >
    > The easiest way to demonstrate the problem is to creat a list of times
    > from 10:00 am to 12:00 pm in 15 minute increments, then copy the list
    > into the adjacent column and convert that list into the decimal
    > equivalent. See below for what the list should look like. I expanded
    > the decimals to the maximum number of decimals.
    >
    > 10:00 0.416666666666667
    > 10:15 0.427083333333333
    > 10:30 0.437500000000000
    > 10:45 0.447916666666667
    > 11:00 0.458333333333333
    > 11:15 0.468750000000000
    > 11:30 0.479166666666667
    > 11:45 0.489583333333333
    > 12:00 0.500000000000000
    >
    > Now if you write a formula using LOOKUP or VLOOKUP to try to return the
    > decimal equivalent of a time in the left column. It works fine except
    > at a few times like 10:45 and 11:30 when it returns the values for
    > 10:30 and 11:15 respectively.
    >
    > Any help would be appreciated.
    >
    > Jeff
    >
    >
    > --
    > jjhmbh
    > ------------------------------------------------------------------------
    > jjhmbh's Profile:
    > http://www.excelforum.com/member.php...o&userid=29748
    > View this thread: http://www.excelforum.com/showthread...hreadid=494626
    >




  5. #5
    Bob Phillips
    Guest

    Re: Referencing Time in Excel

    I think you are entering something incorrectly, as it returns 3 for me.

    Is A1:A5 typed in, or a formula result? I can't get 2 no matter what I have
    tried.

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "jjhmbh" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I am using LOOKUP and use the time value.
    >
    > Also I am referencing the time outside of the array. If I reference
    > the time in the array, it returns the correct value. For instance, if
    > you use the array below
    >
    > <A> <B> <C>
    > 11:00 1 11:30
    > 11:15 2
    > 11:30 3
    > 11:45 4
    > 12:00 5
    >
    > The formula LOOKUP(A3, A1:B5) returns 3
    > But if you reference the value outside of the table, say in cell C1,
    > the formula returns 2.
    >
    >
    > --
    > jjhmbh
    > ------------------------------------------------------------------------
    > jjhmbh's Profile:

    http://www.excelforum.com/member.php...o&userid=29748
    > View this thread: http://www.excelforum.com/showthread...hreadid=494626
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1