+ Reply to Thread
Results 1 to 4 of 4

Using VBA Find smallest date larger than refdate for each lotid

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,669

    Using VBA Find smallest date larger than refdate for each lotid

    I have two columns of data (see enclosed file).

    What i want to do is find the smallest date larger than the refdate (in cell E1) for each lotid. If there is no date larger than the refdate for a given lotid then return "n/a".

    So ideally, i would have two output columns (see file.....cols H and I) where in col H i have the lotid and in col I have the smallest date larger than the refdate.

    I want to do this via VBA.

    Any ideas?
    Attached Files Attached Files
    Last edited by welchs101; 01-10-2012 at 06:52 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357

    Re: Using VBA Find smallest date larger than refdate for each lotid

    Hi Welchs, I don't understand what you mean by the smallest date larger than the ref date? maybe you can fill in some examples of the results you are looking for

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,669

    Re: Using VBA Find smallest date larger than refdate for each lotid

    i am enclosing the same file but this timei am highlighting in yellow those dates, for a given lotid, which are smallest date larger than the date 9/1/11. Bascially, if there is a date for a given lotid larger than 9/1/11......the date that is largest that is closest to the 9/1/11 that is what i am looking for. does this answer your question?
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,669

    Re: Using VBA Find smallest date larger than refdate for each lotid

    i came up with a soln........not sure if its the "best" approach but it works. see enclosed file for macro.
    Attached Files Attached Files

+ 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