+ Reply to Thread
Results 1 to 6 of 6

Choose the newest/oldest date out of multiple dates on inputs

  1. #1
    Registered User
    Join Date
    12-08-2020
    Location
    Groningen
    MS-Off Ver
    2020
    Posts
    7

    Post Choose the newest/oldest date out of multiple dates on inputs

    I am doing a project which requires me to clean up a dataset. The relevant columns are 'Number', 'End_date' and 'Start_date'. The things that require a bit of programming are the following:

    - All the inputs in my dataset are on people that have a number in the dataset. However, on some people there are multiple inputs due to them having performed different functions
    - For all the people that there are multiple inputs, I would like to create one row with data
    - These rows should contain the oldest start date and newest end date

    For example, if the person with number 4 has start dates 01-01-1990 and 01-01-2000, and end dates 01-01-2000 and 01-01-2010, I only need the start date 01-01-1990 and the end date 01-01-2010. I do not exactly know how to program this myself, so I was wondering whether there is anyone here that is able to help me? Thanks in advance!
    Attached Files Attached Files
    Last edited by Jesperdegr; 12-08-2020 at 12:14 PM. Reason: Attached excel file

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Choose the newest/oldest date out of multiple dates on inputs

    Hi Jesperdegr & welcome to the forum

    This can be done but we need a sample file with the same structure of your original file & the expected results so we can provide the necessary code

    Please follow the yellow banner at the top of the page on how to attach a file

  3. #3
    Registered User
    Join Date
    12-08-2020
    Location
    Groningen
    MS-Off Ver
    2020
    Posts
    7

    Re: Choose the newest/oldest date out of multiple dates on inputs

    Thank you! I added the sample data file

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Choose the newest/oldest date out of multiple dates on inputs

    Try the below code based on your sample file ...
    Please Login or Register  to view this content.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  5. #5
    Registered User
    Join Date
    12-08-2020
    Location
    Groningen
    MS-Off Ver
    2020
    Posts
    7

    Re: Choose the newest/oldest date out of multiple dates on inputs

    Thank you so much already! It helped me tremendously. I would now also like to add birth dates to the document so I started playing around a bit with your code. However, it does not seem to work. Can you spot anything that I do wrong? I added the birth date data in the D column.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Choose the newest/oldest date out of multiple dates on inputs

    You are in the right track, just need to change one thing ... From 2 to 3 since you want to place your formulas in 3 columns instead of 2

    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)

Similar Threads

  1. Sorting Dates from Oldest to Newest with the format YYYY-MM-DD
    By jennis7242 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-27-2020, 12:26 PM
  2. Can't sort by newest to oldest if I have more blank cells than dates in a column
    By icordeiro in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-19-2017, 06:28 PM
  3. Unable to sort dates by oldest to newest
    By probuddha in forum Excel General
    Replies: 8
    Last Post: 06-25-2016, 08:27 AM
  4. [SOLVED] Dates seem formatted correctly, but will not sort newest to oldest.
    By MelindaCapri in forum Excel General
    Replies: 6
    Last Post: 02-11-2015, 02:34 PM
  5. How to change this code to sort dates from the oldest to the newest
    By bazofio in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-29-2014, 05:24 PM
  6. [SOLVED] Sort dates in column from oldest to newest...
    By ILoveYouExcel in forum Excel General
    Replies: 2
    Last Post: 06-11-2014, 02:11 PM
  7. [SOLVED] vba to sort columns according to dates in header from oldest to newest.
    By rocksan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-25-2012, 12:57 AM

Tags for this Thread

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