+ Reply to Thread
Results 1 to 7 of 7

Index match not working for time matches consistently

  1. #1
    Registered User
    Join Date
    07-03-2019
    Location
    Maitland NSW
    MS-Off Ver
    365
    Posts
    3

    Index match not working for time matches consistently

    Hi people,

    I've gone around in cycles doing this. In column H, I have a formula using the index match functions. The format of the lookup value and the lookup array appear the same.
    It would be wonderful is someone could get this to work for me.

    Thanks in advance
    indexmatch.xlsx

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,461

    Re: Index match not working for time matches consistently

    You can change the formula in H2 to this:

    =CELL("address",INDEX($J$1:$AG$1,MATCH(F2+TIME(0,0,1)+(F2<TIME(6,0,0)),$J$1:$AG$1,1)))

    then copy it down. The additions to the formula are shown in red and blue. The red additions add 1 second to the time in F2 and reduce the search to an approximate (less than) match. As times are stored internally in Excel as fractions, it can be difficult to achieve exact matches, so this technique improves the success rate of the matches. The blue additions take account of your times on row 1 starting with 6:00am, and continuing beyond midnight - instead of 1:00am or 2:00am, those values are actually 25:00am and 26:00am etc., so the blue amendment just adds 1 on for time values below 6:00am.

    Hope this helps.

    Pete

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: Index match not working for time matches consistently

    Hi there's another option - you could convert the lookup value and the lookup range to text..

    H2=CELL("address",INDEX($J$1:$AG$1,MATCH(TEXT(F2,"hh:mm AM/PM"),$J$1:$AG$1,0))) and copied down

    J1=TEXT("06:00","hh:mm AM/PM")

    K1=TEXT(J1+TIME(1,0,0),"hh:mm AM/PM") and copied across.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Registered User
    Join Date
    07-03-2019
    Location
    Maitland NSW
    MS-Off Ver
    365
    Posts
    3

    Re: Index match not working for time matches consistently

    Fantastic. It worked. Much better than ChatGPT

  5. #5
    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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,734

    Re: Index match not working for time matches consistently

    Well, what do you expect? We are HUMAN!!!

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED. You can also access the SOLVED tag by editing the opening post and choosing SOLVED from the drop-down to the left of the title box.

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.
    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.

  6. #6
    Registered User
    Join Date
    07-03-2019
    Location
    Maitland NSW
    MS-Off Ver
    365
    Posts
    3

    Re: Index match not working for time matches consistently

    Thanks for that. I'll keep that as plan B

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,461

    Re: Index match not working for time matches consistently

    Glad to help, and thanks for the rep.

    Pete

+ 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. [SOLVED] VLOOKUP and INDEX MATCH not working all the time / Intermittant results
    By MrImpeccable in forum Excel Formulas & Functions
    Replies: 30
    Last Post: 10-23-2018, 12:02 PM
  2. Index Match only working part of the time
    By boynejs in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-14-2018, 01:30 AM
  3. [SOLVED] Offset, Match, CountIF not working consistently
    By sick stigma in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-22-2018, 01:17 PM
  4. [SOLVED] INDEX MATCH array formula that matches substring n gives multiple matches
    By bkwins in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-12-2013, 04:57 AM
  5. Replies: 4
    Last Post: 07-18-2012, 02:34 PM
  6. 24 hour time not working in formula consistently
    By snake in forum Excel General
    Replies: 1
    Last Post: 09-15-2011, 12:52 PM
  7. Index-Match Function Not Working all the time
    By hoosierhunter in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-08-2007, 06:58 PM

Tags for this Thread

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