+ Reply to Thread
Results 1 to 3 of 3

Help with matching TIME formula from a list

  1. #1
    Registered User
    Join Date
    07-01-2022
    Location
    UK
    MS-Off Ver
    365
    Posts
    1

    Help with matching TIME formula from a list

    Hi all,

    I m a relative newbie to excel and would really appreciate some assistance with a formula I'm playing with.

    Example problem: I have a list of train times and am trying to get excel to load up the next train time from the list based on the current time.

    The formula I am using to generate the next departure time is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    $B$12:$B$83 is the source list of times
    $B$1 is the current time

    Although the formula does match to the nearest train time from the list, I sometimes find that the matched time is in the past (e.g. current time 21:10, but excel highlights 20:56 as the next departure train time as its the closest match to the list, although in the past so not helpful if Im looking to get onto the next train).

    Is there a way I can tweak the formula so that it matches to the next greatest timing from the list?

    Thanks in advance

    E
    Last edited by EvoUK; 07-01-2022 at 04:42 PM.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Help with matching TIME formula from a list

    Do you want to tweak this formula/algorithm or try a different one? The algorithm I would have used, assuming the times in B2:B83 are or can be sorted in descending order, would be to use a simple "approximate match" search (3rd argument of MATCH() is -1).

    1) Find the row with the time equal to or just larger than the value in B1 MATCH($B$1,$B$12:$B$83,-1). Again, I will emphasize that B12:B83 must be sorted in descending order.
    2) Use an INDEX() function to return the value in that row =INDEX($B$12:$B$83,MATCH($B$1,$B$12:$B$83,-1))

    Would that work for you?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,929

    Re: Help with matching TIME formula from a list

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. As you are new here, I wil, do it for you this time: https://www.mrexcel.com/board/thread...lease.1209547/ )
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. matching unique events against a list of flights with takeoff and landing time
    By dannycarr2k in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-28-2021, 04:47 AM
  2. Formula to find greatest time for matching Username and Date
    By prabhuduraraj09 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-20-2019, 01:18 AM
  3. Formula to find greatest time for matching ID
    By prabhuduraraj09 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-12-2019, 04:40 PM
  4. [SOLVED] Formula to add time's matching 2 criteria.
    By oneblondebrow in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-22-2016, 08:07 AM
  5. [SOLVED] Matching List Formula Error
    By TitansGo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-27-2016, 01:10 PM
  6. [SOLVED] Alter Matching Sub From matching two Ranges to matching one range and list
    By capson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-14-2015, 10:48 PM
  7. Validation List with Matching formula
    By elfiky in forum Excel General
    Replies: 0
    Last Post: 09-22-2010, 11:11 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