+ Reply to Thread
Results 1 to 9 of 9

Reduce a list of dates

  1. #1
    Registered User
    Join Date
    03-26-2017
    Location
    London
    MS-Off Ver
    13
    Posts
    23

    Reduce a list of dates

    Hi,

    I have a list of participant ID's and start and stop dates for when they have been on a medication. Some participants have multiple rows but I would like one row per participant.

    Participant Start date Stop date
    1 24.11.2011 01.01.2016
    1 18.02.2010 24.11.2011
    1 24.11.2011 01.01.2016
    1 18.02.2010 24.11.2011


    I would like to just take the earliest date for the start date and the latest date for this stop date.

    Participant Start date Stop date
    1 18.02.2010 01.01.2016


    Any help would be greatly appreciated!

    https://www.mrexcel.com/forum/excel-...ist-dates.html

    http://www.ozgrid.com/forum/showthread.php?t=203740

    Thank you
    Last edited by London123; 04-12-2017 at 04:49 PM.

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Reduce a list of dates

    AliGW it appears OP has complied. I'm taking that as a "green light".

    London123, with the understanding that data is in columns A:C and output is in columns E:G ---

    Enter this formula in E2 and fill down until you get blanks. It returns the unique 'Participant' #s
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In F2 array enter this formula and fill down same. If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter. It returns the earliest Start Date for each Participant.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Then array enter this formula in G2 and fill down. It returns the latest Stop Date for each Participant.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Dave

  3. #3
    Registered User
    Join Date
    03-26-2017
    Location
    London
    MS-Off Ver
    13
    Posts
    23

    Re: Reduce a list of dates

    Thank you so much for your help!

    I am having trouble with the first formula when I take it to my real data set.

    =IFERROR(SMALL(IF(FREQUENCY($A$2:$A$14,$A$2:$A$14),$A$2:$A$14),ROWS($2:2)),"") (I changed $A$14 to $A$3216 because I have a much longer list).

    I have the data in columns A:C and the output will be in columns E:G -

    When I copy the formula it doesn't say formula error, it just produces a blank space.

    The only difference between my real spreadsheet and the one I sent you is that the ID numbers are much longer than 1, 2, 3, 4 etc. They are 9 digits with dashes in between, do you think that might make a difference?

    Thanks!

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Reduce a list of dates

    The only difference between my real spreadsheet and the one I sent you is that the ID numbers are much longer than 1, 2, 3, 4 etc. They are 9 digits with dashes in between, do you think that might make a difference?
    Yes. The dashes make the numbers text "numbers". The formula I posted depends upon data in $A$2:$A$14 having numeric value.

    Text requires some extra steps in the FREQUENCY formula, and this time it has to be array entered.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The rest of your formulas will still work.

    (I changed $A$14 to $A$3216 because I have a much longer list).
    I don't know how much that many rows of data will affect workbook performance. If you are not aware of it array formulas are resource hungry. Too many of them or arrays too large will slow a workbook. My 'instincts' tell me you will OK, but they have lied to me before.

    Also the output could be more of a resource issue. How many rows of output do you anticipate ie how many unique IDs do you have?

    Try this on the real data. If performance is unacceptable the remedy will be a 'helper' column for the ID formula. If that still doesn't do it I will have to explore further steps for the date returns.
    Last edited by FlameRetired; 04-13-2017 at 07:05 PM.

  5. #5
    Registered User
    Join Date
    03-26-2017
    Location
    London
    MS-Off Ver
    13
    Posts
    23

    Re: Reduce a list of dates

    Thank you for your fast response! I think it is too much for the workbook because it keeps freezing/ shutting down. If you don't mind and if you have time, please may you try to create a helper column?

    Thank you!

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Reduce a list of dates

    Alternative approach:

    J2 (participants): =IFERROR(INDEX($A$2:$A$14,MATCH(0,INDEX(COUNTIF($J$1:$J1,$A$2:$A$14),0),0)),"")

    K2 (start date): =IFERROR(AGGREGATE(15,6,$B$2:$B$14/($A$2:$A$14=J2),1),"")

    L2 (End date): =IFERROR(AGGREGATE(14,6,$C$2:$C$14/($A$2:$A$14=J2),1),"")

    all "normal" formulae...
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 04-15-2017 at 03:38 AM.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Reduce a list of dates

    Hi London,

    You can do this problem without using any formulas. Just create a Pivot Table as shown in the attached. (Thanks to Glenn) Use a Min for the Start and Max for the End.

    PT Reduce a list of dates.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  8. #8
    Registered User
    Join Date
    03-26-2017
    Location
    London
    MS-Off Ver
    13
    Posts
    23

    Re: Reduce a list of dates

    Thank you so much for your help!

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Reduce a list of dates

    You're welcome & thanks for the Rep.

+ 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. Populating list of dates from another sheet with Start Dates and End Dates
    By Jesshloly in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-05-2015, 04:07 AM
  2. Replies: 1
    Last Post: 01-26-2015, 04:42 PM
  3. Replies: 1
    Last Post: 12-17-2013, 03:18 PM
  4. [SOLVED] From a list of dates that changes in length, make list with all middle dates
    By tinytutu in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-21-2013, 01:56 AM
  5. Reduce multpiple names to single list
    By papah73 in forum Excel General
    Replies: 2
    Last Post: 08-03-2013, 07:05 AM
  6. [SOLVED] Highlight Group of Dates if Dates Match List of other Dates
    By martinpgibson in forum Excel General
    Replies: 5
    Last Post: 10-24-2012, 08:14 PM
  7. Reduce a list of multiple entries to a single list
    By Jogier505 in forum Excel General
    Replies: 6
    Last Post: 03-24-2011, 09:39 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