+ Reply to Thread
Results 1 to 5 of 5

Compare and find nearest date with criteria

  1. #1
    Registered User
    Join Date
    06-01-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    38

    Compare and find nearest date with criteria

    Finding nearest date(others1-5) compared to Column C's dates(birthday).

    Criteria
    --------

    1. must not be after column C's dates

    2. must be at least 4 days apart

    attached comments in spreadsheet.

    Date Example.xlsx

    Thanks in advance!

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Compare and find nearest date with criteria

    Maybe one possibility...

    =IF(C3-INDEX(D3:H3,MATCH(C3,D3:H3))>4,INDEX(D3:H3,MATCH(C3,D3:H3)),INDEX(D3:H3,MATCH(C3,D3:H3)-1))
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    06-01-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Compare and find nearest date with criteria

    Hi Jeffreybrown, thanks for the reply.

    What if the others1-5 dates are in random order? which would affect the first part of the formula in some circumstances i think
    Last edited by Dwexdwex; 08-18-2013 at 01:44 AM.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Compare and find nearest date with criteria

    Yes it would affect the outcome.

    If your workbook is setup different than the one you posted, please post your real requirements.
    Last edited by jeffreybrown; 08-18-2013 at 09:15 AM.

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Compare and find nearest date with criteria

    As far as I understand your problem, the expected result of row 5 is not correct. The result should be July 1 and not July 6.

    This compares pairs of columns and if they are 4 days apart and not past the birthday then this appears to work...at least as far as I was able to test.


    Formula: copy to clipboard
    Please Login or Register  to view this content.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

+ 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] find missing date on every group date list based on range and criteria
    By k1dr0ck in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2013, 01:26 AM
  2. Find nearest available date that meets criteria
    By scottylad2 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-16-2013, 03:17 PM
  3. [SOLVED] Compare strings for match in separate worksheet and return nearest future date
    By kungfood in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-05-2012, 05:19 PM
  4. Filling in column based on date compare criteria
    By Mare0929 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-19-2011, 10:22 AM
  5. How to find nearest date to that of given
    By TRJJK73 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-16-2008, 06:30 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