+ Reply to Thread
Results 1 to 5 of 5

find closest match to a given value

  1. #1
    Forum Contributor Grimace's Avatar
    Join Date
    05-04-2009
    Location
    Gold Coast, Australia
    MS-Off Ver
    Excel 2013 and Office 365 Plus
    Posts
    380

    find closest match to a given value

    Good morning

    In the attached sheet, I am using !Staff times columns N and O to nominate a mid point break time relevant to the start,lunch break and finish times of a shift.

    What I would like to do is match the result to the closest time from !Race Times Column D (highlighted green). So if for example the mid point of the shift is 10:37 (as in !Staff Times cell N23), it actually comes back with the !Race Times result of 10:35 which is the closest actual race.

    Ideally I would like it to look both sides of the midpoint time until it came to the closest match, rather than always looking at an earlier time, or always a later time (eg the cell N79 has a value of 11:36, however the 2 race times are 11:35 and 11:40. Preference is it shows 11:35). If however the N79 result was 11:38 or 11:39, I would prefer it went to 11:40).

    However if this is not possible then picking the next time in either direction will do.

    Thanks
    Darren
    Attached Files Attached Files
    Last edited by Grimace; 05-21-2009 at 09:25 PM. Reason: Problem Solvered :)

  2. #2
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: find closest match to a given value

    Does this help?

    http://www.xl-central.com/lookup-closest-match.html

  3. #3
    Forum Contributor Grimace's Avatar
    Join Date
    05-04-2009
    Location
    Gold Coast, Australia
    MS-Off Ver
    Excel 2013 and Office 365 Plus
    Posts
    380

    Re: find closest match to a given value

    Sorry Domenic, no that one does not appear to be working.

    I think it may have somethihng to do with the formatting of the values within the cells. I am having trouble with many formulas not recognising the custom format of hh:mm

    I placed the formula from your suggestion into column T on the attachment, and modified it to the table addresses, however it is not happening for me.

    Darren
    Attached Files Attached Files

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: find closest match to a given value

    Darren, the issue is that the times on WTTN sheet are actually DateTime values, eg: D3: 1st Jan 1900 10:10:00 ... so you need to extract just the Time element for your formula such that:

    T15:
    =INDEX(WTTN!$D$3:$D$164,MATCH(MIN(ABS(MOD(WTTN!$D$3:$D$164,1)-$Q15)),ABS(MOD(WTTN!$D$3:$D$164,1)-$Q15),0))
    committed with CTRL + SHIFT + ENTER
    copy down as required

    in the above we've added a MOD to the function - this will extract just the TIME element from the WTTN values.

  5. #5
    Forum Contributor Grimace's Avatar
    Join Date
    05-04-2009
    Location
    Gold Coast, Australia
    MS-Off Ver
    Excel 2013 and Office 365 Plus
    Posts
    380

    Re: find closest match to a given value

    thanks for your help ... problem solved

+ 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