+ Reply to Thread
Results 1 to 4 of 4

Unique Key find MAX Date w/out Going Over Another Date

  1. #1
    Forum Contributor
    Join Date
    07-22-2013
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2010
    Posts
    100

    Unique Key find MAX Date w/out Going Over Another Date

    I work at a school. We have leads that we try to convert to a student, the funnel is lead, application, and student.

    I'm trying to find the campaign where the student transferred from application to student, which is called the primary campaign. The systems is technically set up to do this automatically based on the below; however, I'm finding that a sales member is going in and adjusting that primary campaign.

    I have attached an example and in column AA shows that I want the final answer to be. This is a massive spreadsheet of multiple leads and dates they were leads and dates they were applications.

    Essentially these are the parameters: The application date must be less than the student start date and the closest application date to the start date. Column X "Was Application" needs to be a 1. Because there are times where there is a start date associated to it, but they didn't finish.

    You can see that in column I, there is a 1 on the top row right next to the primary campaign source of Sales Generated. Based on the dates for this specific lead, it should be a "Webinar" not "Sales Generated".
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Unique Key find MAX Date w/out Going Over Another Date

    Hello mphillips,

    If you have a huge amount of data, I really recommend finding a VBA solution since I believe VBA will be a much better approach.

    Other than that, here is an attempt to purely using formula, with the help of 5 extra columns:
    1. Column AB returns the Max Date that matches your criteria for that unique key (helper for AA, the result column)
    2. Column AC tells if a row qualified for the criteria or not (helper for AB)
    3. Column AD returns the number of unique keys found (helper for all column)
    4. Column AE tells the first row containing the unique key in that row (helper for all)
    5. Column AF tells the last row containing the unique key in that row (helper for all)
    And finally, Column AA just simply compare the Application Date to the date in AB.

    I did it like this since I believe you will have many unique keys, not just one.
    The only downside of this is that:
    1. Formula in AB is an Array Formula - it is slow when there are huge amount of data, and you have to Ctrl-Shift-Enter to enter it (you will see it wrapped inside a { } ) and
    2. You will have to sort by unique keys - order won't matter

    Here is your sample file with the said formula. Is this what you are looking for?
    Attached Files Attached Files
    Last edited by Lemice; 06-07-2016 at 10:48 PM.
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  3. #3
    Forum Contributor
    Join Date
    07-22-2013
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2010
    Posts
    100

    Re: Unique Key find MAX Date w/out Going Over Another Date

    That worked perfectly. Thank you very much!

  4. #4
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Unique Key find MAX Date w/out Going Over Another Date

    Thank you for the feed back. Glad that I could help.

    Have a great day!

+ 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 the Exact date, Nearest old and new date for the given input Letter) and date
    By thilag in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-17-2015, 05:13 AM
  2. [SOLVED] look-up a date in a range and find the date that is closest todays date
    By VanShark in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-12-2014, 09:46 PM
  3. Replies: 5
    Last Post: 01-16-2014, 11:51 AM
  4. [SOLVED] Find the date and copy the values from the colum of the date find and paste to other sheet
    By nizzcmzph in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-20-2013, 10:03 AM
  5. Replies: 2
    Last Post: 01-04-2012, 09:15 AM
  6. find date interval for unique id excel
    By quaye28 in forum Excel General
    Replies: 0
    Last Post: 10-13-2011, 10:07 AM
  7. code not unique find latest date
    By Barbara Wiseman in forum Excel General
    Replies: 3
    Last Post: 12-11-2005, 04:55 AM

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