+ Reply to Thread
Results 1 to 12 of 12

Lookup from a date to a date range

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,062

    Lookup from a date to a date range

    Some days I'm much stupider than others. This is one of those days.

    In the attachment I have mileage expenses by the period in our fiscal year in which they were paid out (like "2024_01","2024_02").
    I also have the "Service Date", the date they actually did the driving.

    For each time period in which they drive (not when they get paid for it) they have a travel rate (cents per mile).

    I need to convert these expenses to the miles they traveled (that info doesn't show in our expense files), which is the simple equation "Expense/Rate".
    So, I need to do a lookup from the Service date to the corresponding date range to return the rate in place at the time.

    That's where I'm drawing a blank, how do I lookup from a date to a date range?

    If it helps to redo my little rate table that's not a problem, I haven't redone because I can't yet figure out how to approach this problem.

    Any help would be appreciated.
    Attached Files Attached Files
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Lookup from a date to a date range

    DFPS appears where???
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,062

    Re: Lookup from a date to a date range

    "DFPS appears where???"

    Not sure what your question means. I work for DFPS, but don't see anything about that in my question.

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Lookup from a date to a date range

    Its mentioned in the big yellow table with dates and rates....

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,062

    Re: Lookup from a date to a date range

    ah, that's where. It's the rates for all Texas Government entities. For one very short period DFPS had it's one rate.

    I'm heading away, won't be able to reply again until tomorrow.

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Lookup from a date to a date range

    No problem I'm away for the night, too.

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,987

    Re: Lookup from a date to a date range

    Here's the basic approach with a lookup table.
    Attached Files Attached Files
    Everyone who confuses correlation and causation ends up dead.

  8. #8
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,062

    Re: Lookup from a date to a date range

    Thanks Rorya, that seems to get it. But one thing I noticed, your rate table is sorted frorm Oldest to most recent. if I sort my rate table from most recent to oldest the formula doesn't work right. So should I always have my rate table sorted from Oldest to most recent?

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,716

    Re: Lookup from a date to a date range

    No need if you add SORT to the formula:

    =LOOKUP(A6,SORT($N$5:$O$12,1,1))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  10. #10
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,062

    Re: Lookup from a date to a date range

    Sweet! So it's always sorted, no fuss, no muss!

  11. #11
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,987

    Re: Lookup from a date to a date range

    You could also use XLOOKUP and tell it to find the value or the closest lower number:

    Formula: copy to clipboard
    =XLOOKUP(A6,$P$5:$P$12,$Q$5:$Q$12,,-1)

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,716

    Re: Lookup from a date to a date range

    Glad to have helped.

    Thanks for the kind rep comment.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 09-30-2022, 09:28 AM
  2. Replies: 2
    Last Post: 08-09-2022, 04:25 PM
  3. Replies: 6
    Last Post: 12-17-2018, 05:45 PM
  4. [SOLVED] Formula to Lookup value based on date within a date range
    By MHamid in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-26-2013, 02:24 PM
  5. Replies: 2
    Last Post: 06-07-2013, 02:21 PM
  6. [SOLVED] Create Fiscal Year - Lookup Date in Fiscal Month Date Range and Return EOM Date
    By gbriscoe in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-25-2013, 03:29 PM
  7. [SOLVED] lookup date within date range grid to return fiscal month value
    By tigerseye001 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-10-2012, 02:27 PM

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