+ Reply to Thread
Results 1 to 2 of 2

Finding the nearest date in a column with reference to today

  1. #1
    Registered User
    Join Date
    03-14-2013
    Location
    manila, Philippines
    MS-Off Ver
    Excel 2007
    Posts
    1

    Finding the nearest date in a column with reference to today

    Hi everyone.

    I am stuck trying to figure out a macro. Basically, I have a column of dates with details a few columns away. When I run the macro, I want it to
    search for the closest (past) date with reference to the date when the macro was run.

    For example, today is March 21, 2013, and I have March 1, 5, 10, 18, 22, 26 in the column of dates. When I run the macro I want it to generate the data from March 18 (being the closest date). Like the amount to the right of March 18. Afterwards, it would just move to the next worksheet and process the same set of commands. (the details will be shown on the first sheet, while the 2nd sheet until the nth sheet will contain all the data).

    I have an ideas with the min function, where I'll subtract the column of dates to the date today, then see which one has the smallest positive (or negative) number. I have no idea how to actually translate this into code :| Please help!

    P.S. The date isn't limited to just a month. It could be as long as 6 months or so. (not more than a year I think)

  2. #2
    Forum Contributor
    Join Date
    12-31-2012
    Location
    Jhang, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Finding the nearest date in a column with reference to today

    Please Login or Register  to view this content.

+ 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