+ Reply to Thread
Results 1 to 10 of 10

Rearranging an time series with missing dates

  1. #1
    Registered User
    Join Date
    07-09-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    6

    Rearranging an time series with missing dates

    Hello,

    I need some help to rearrange a time series wich has some missing dates.
    The attached file has a exemple of my problem; it's better to see it to understand.

    The original information ("date" and "temperature") has some missing days.
    So, I need to make two corrected columns ("result") that consider these null values​​, based on the "reference date".

    The idea of the algorithm seems to be easy (I think, but I don't know how to do it):

    1. The VB macro should check if the date is equal to the reference date;
    1.1 If equal, hence it takes this value;
    1.2 If not equal, hence it have to do an iteration in which the cell column scroll down until it find the next cell with the same date value.

    I hope that somebody understand my problem and help me to solve this.
    My apologies about any English mistake.

    Thank you very much!


    date.xls

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Rearranging an time series with missing dates

    Could you in your attachment show the result you would like to end up with? E.g. what should the values in E4 and E6 be?
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  3. #3
    Registered User
    Join Date
    07-09-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Rearranging an time series with missing dates

    Dear Søren,

    Thank you for the fast reply.
    No value has to change on the column E. The E4 and E6 stay blank, no calculation is needed. It only has to maintain the correspondence with the original day.
    The expected result is the columns D and E, just the way it is shown at this worksheet.
    The columns D and E are the reordering/rearranging of the original values, but now considering the null days (e.g. D4, E4; D6, E6; D8:D9... they all stay with blank values) which are not shown on the original data.
    So, the result columns are the original date + blank days.

    Thank you!
    Best greetings.

  4. #4
    Registered User
    Join Date
    07-09-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Rearranging an time series with missing dates

    And to be clear with my problem...
    The example I sent it's only one piece of 300 spreadsheets that have, each one, more than 50,000 lines with data.
    That's why It would be necessary a VB script to facilitate the work.

  5. #5
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Rearranging an time series with missing dates

    Quote Originally Posted by bafuncio View Post
    And to be clear with my problem...
    The example I sent it's only one piece of 300 spreadsheets that have, each one, more than 50,000 lines with data.
    That's why It would be necessary a VB script to facilitate the work.
    Ahh, ok. I was about to suggest using formulae instead. I'll see if anyone can offer a VB solution.

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Rearranging an time series with missing dates

    bafuncio,

    Welcome to the forum!
    Give this a try:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Registered User
    Join Date
    07-09-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Rearranging an time series with missing dates

    WOOOW!!! This is amazing!
    It worked like a magic! Perfect!!

    Thank you so much, tigeravatar!!!


    Quote Originally Posted by tigeravatar View Post
    bafuncio,

    Welcome to the forum!
    Give this a try:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-09-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Rearranging an time series with missing dates

    People,

    A friend of mine got another solution using only formulas, and I would like to share it here with you.
    You can see the entire solution inside the attached file, but here I show one line of the code:

    Please Login or Register  to view this content.
    This code was translated from the Office Portuguese version.
    I hope that the attached file opens correctly with the English formula.
    This isn't an automatic method like the wonderful tigeravatar's solution, but it's another possibility.

    Thank you all!
    Sincerely,
    Bafuncio.

    date_solved.xls
    Last edited by bafuncio; 07-09-2012 at 04:21 PM.

  9. #9
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: Rearranging an time series with missing dates

    Since you are using Excel 2010 you might as well use:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    But as you have 50,000 rows of data and 300 files, you'll be better of with the macro.

  10. #10
    Registered User
    Join Date
    07-09-2012
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Rearranging an time series with missing dates

    Sure I will!
    That macro is the best, really!
    Thank you!!

    Quote Originally Posted by Søren Larsen View Post
    Since you are using Excel 2010 you might as well use:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    But as you have 50,000 rows of data and 300 files, you'll be better of with the macro.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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