+ Reply to Thread
Results 1 to 8 of 8

Listing dates with corresponding row values in order in columns from oldest to newest

  1. #1
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    188

    Listing dates with corresponding row values in order in columns from oldest to newest

    Greetings,

    I need to rearrange my data somehow so that they line up in two columns with values from oldest down to newest. The data are dated and each date may have multiple values in corresponding rows. Which is the most efficient way to line up the dates with each value in sequential order down two columns?

    In the sheet example, rows 5 through 8 are dated and each row has several values listed horizontally for each date. How can they be rearranged so that they line up as shown in column W and X?
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,672

    Re: Listing dates with corresponding row values in order in columns from oldest to newest

    Using Power Query/Get and Transform located on the Data Tab of the Ribbon.

    Load your table and then perform an unpivot. Here is the Mcode of those steps. File attached so you can review steps
    Please Login or Register  to view this content.
    Review PQ
    In the attached file
    Click on any cell in the new table
    On the Data Tab, click on Queries & Connections
    In the right window, double click to open Query
    Review PQ steps

    M-code basics:
    - "let" is the start of a query
    - "in" is the closing of a query
    - each transformation step sits in between those 2 lines
    - each step line is ended by a comma, except the last one
    - "Source" is always the first step (Source Data)
    - After "in" you have the last step referenced
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    188

    Re: Listing dates with corresponding row values in order in columns from oldest to newest

    Thank you Alan,

    This seems to be a solution. I'm not familiar with Power Query. Allow me to get acquainted with this process in a bit.
    BTW, in the attached file, why is there a value of 8 in the B2 cell? This is not a listed value.
    Attached Files Attached Files

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,672

    Re: Listing dates with corresponding row values in order in columns from oldest to newest

    Not sure what happened there. I refreshed the table and the correct numbers appeared. See attached. My apologies. I am thinking it was an earlier version that I forgot to refresh.

    Also if you wish to learn more about Power Query, then the book "M is for (Data) Monkey" available on Amazon is a good Primer. Also check out the links in my signauture.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    188

    Re: Listing dates with corresponding row values in order in columns from oldest to newest

    Alan,

    Did some studying of Power Query and played around with it. Nifty!
    I was able to make the necessary corrections by removing the D & E columns before unpivoting the data columns. I like this!

    I did notice that the sheet2 file does not refresh when new data is entered in the TimeOut file table unless I manually refresh the file.
    Quick question, is there a way for this sheet to automatically refresh wnenever new data is entered on the table?

    Thanks bunches!

  6. #6
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    188

    Re: Listing dates with corresponding row values in order in columns from oldest to newest

    Most likely will use this method but I'm wondering if there are other ways to have these columns created on another sheet so I have just the dates in one column and the data in the adjacent column?

    My concern is for a method that will be dynamic enough to allow for new data entries to be entered and automatically appended to the list.

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,672

    Re: Listing dates with corresponding row values in order in columns from oldest to newest

    Quick question, is there a way for this sheet to automatically refresh whenever new data is entered on the table?
    Click on the Queries and Connections and then Right Click on the Query then Properties. You can make some preference selections on Refreshing here.

  8. #8
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    188

    Re: Listing dates with corresponding row values in order in columns from oldest to newest

    Again, thanks bunches for your help and suggestions. This is going to make a difference!

+ 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. Replies: 3
    Last Post: 01-18-2017, 02:02 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

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