+ Reply to Thread
Results 1 to 16 of 16

Find exact or closest lower date

  1. #1
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Find exact or closest lower date

    Hi,
    I am looking for a formula to return the expected row/location in range B2:B13 as shown in col. F
    Col. B dates are and cannot be sorted
    The idea is to find the exact or the closest lower date to those in col. E
    as per two criterias (col. D+E)
    I prefer no helper column and no macro
    (see attached WB)
    If it is not too much to ask, please reply with an attached WB with the requested Formula.
    Thanks,
    Elm
    Attached Files Attached Files

  2. #2
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Find exact or closest lower date

    Can u explain why 1st april's expected result is 3 (F2)?
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Find exact or closest lower date

    Can u explain why 1st april's expected result is 3 (F2)?
    the closest date to 1-Apr-09 in column B with a "C" in column A is 4-May-09, which is in the third row of the data table. Thus the result is 3

    With the data table in columns A and B not sorted, it will be be virtually impossible to use any kind of lookup or match function to establish the closest match.

    Elmer, can the order of the data in A and B be changed? Otherwise, your call for a solution without a macro and without helper columns will probably not come to any result.

  4. #4
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Find exact or closest lower date

    aaaaaaa
    understand.... thx...

  5. #5
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Find exact or closest lower date

    Try this one
    Array entered

    Please Login or Register  to view this content.

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Find exact or closest lower date

    Copy of Book4(1).xls

    Here's my solution and contaminedwithexcel...

    We both have errors...

    Contamined: I started with ABS but it won't work.. He needs first less value than 0...

    So if dates differences are -3, -2, 1 he need to return -2 ( I guess).

    i have problem with matching data... I find correctly dd.mm.yy for a specific category (C,D,E) but if there's some same date before he return that row...
    Last edited by zbor; 12-19-2009 at 06:41 AM.

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Find exact or closest lower date

    ContaminatedWit: Close, but not quite.

    copy from row 2 down to row 11 and see that it does not meet the expected results in a few rows.

    Elmer, I don't understand why F5 should be 11. The closest date to 6-may-09 with a C in the first column would be 4-may-09, so the result would be 3

    This is what ContaminatedWit's formula delivers.

    So, is your sample data correct? If so, you've got some more explaining to do.
    Last edited by teylyn; 12-19-2009 at 07:47 AM. Reason: specified poster addressed

  8. #8
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Find exact or closest lower date

    My formula is long But just because of ISNA testing...
    Because I get error if date matching...

    SO, idea is: IF(ISNA(match:exact_result);formula;exact_result)

  9. #9
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Find exact or closest lower date

    I really can't find errors. Where they are?

  10. #10
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: Find exact or closest lower date

    But closest value for 28 April in column E is 27 April in column B, They both have "D" suffix... what wrong here?

  11. #11
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Find exact or closest lower date

    It's greater than 27.. so you look for first next lowest

  12. #12
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Find exact or closest lower date

    Woo hoo.. my formula seems to be working.. although I don't know why is expected in F5 and F6 solutions that aren't "C" :

    Please Login or Register  to view this content.

  13. #13
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Find exact or closest lower date

    it's frustrating to see that the OP is online all the time we're wrecking our brains, but can't be bothered to check back and contribute....

  14. #14
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Find exact or closest lower date

    Please don't get frustrated.
    I'm not around the computer all the time.
    Here is the original task sent to me from a good friend of mine.
    Elm
    Attached Files Attached Files

  15. #15
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Find exact or closest lower date

    What do you want to get?

    In D column what version should be?

  16. #16
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Find exact or closest lower date


    If I wasn't clear enough in what I explained inside my last attachment let me try again:

    1) Col. A+B hold the raw data.
    2) Col. C presents the expected results, to be drawn from the table in G2:J13.
    These results are, for now, typed by hand! and there may be some mistakes but in general this what the requested formula should return.
    3) Col. D holds my trial formula - which should return the col. C values but, unfortunately, it is not good enough as it returns N/A errors in some cases .

    Thanks, Elm
    Last edited by ElmerS; 12-19-2009 at 10:10 AM.

+ 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