+ Reply to Thread
Results 1 to 8 of 8

Q: Creating a timeline from a list of events

  1. #1
    Registered User
    Join Date
    01-30-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Q: Creating a timeline from a list of events

    My sincerest appreciation to all of you in this user group who put the time into helping others.

    I retrieve a list of events from a database and want to turn that into a specific sort of timeline in Excel. But the pivoting and tranformation process is beyond me.

    The events relate to people and each has a date. I want to consolidate each person's events by month, and show successive months as separate columns. The attachment shows this more clearly.

    There is a large amount of such data and I need to generate these timelines regularly -- so it is worthwhile developing an efficient, repeatable process.

    Matt.
    Attached Files Attached Files
    Last edited by Matthew Clarke; 01-31-2012 at 05:54 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Q: Creating a timeline from a list of events

    Hi

    As you have character items in the events, I don't know that pivot tables will be an option. Only think I can think of is a macro.

    Below will produce your output on the same sheet, starting in I1. This may not be viable with your full data (you may need to output to a completely separate sheet), but for the nonce can you give it a go and see if it is viable in your situation.

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    01-30-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Q: Creating a timeline from a list of events

    Wow, that's a fast and valuable response rylo. Thanks.

    Perhaps it was wishful thinking that the task could be performed without programming. I can run your code and understand how it works. I haven't written any code for *years* but should be able to modify yours to suit our need. So another big thank you.

    If I can stretch your generosity, can you suggest how to improve this line ...

    Please Login or Register  to view this content.
    That will give false matches when one event code is a substring of another. Is there a VB function that might look for tokens in a string more accurately?

    Matt.

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Q: Creating a timeline from a list of events

    Matt

    You could split things out into an array, and then use match to see if it exists.

    If you are unsure about this then update your example file with more representative event items and specifically give an example of the type of thing that you will be facing.

    rylo

  5. #5
    Registered User
    Join Date
    01-30-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Q: Creating a timeline from a list of events

    In the updated version of the example spreadsheet, I have included your macro (renamed to Build_Timeline). I have changed just one data value -- C4 is now "ABC" rather than "A". After running the macro, J2 is now incorrect: it should be "ABC, B, A" but instead shows "ABC". The problem is caused by the "if" condition I quoted in previous reply -- the InStr function finds "B" within "ABC,".

    Matt.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-30-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Q: Creating a timeline from a list of events

    Update: I've adjusted your code now to deal with cases where one event code is a substring of another. Basically using commas (assumed to never appear in an event code) as code delimiters.

    Thanks again for your help.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Q: Creating a timeline from a list of events

    Hi

    Not sure that will be definitive. What happens if you repeat the first event code that is found? I don't think the second one will match the first as the first won't have the ", " on both sides of the code.

    rylo
    Last edited by rylo; 01-31-2012 at 05:54 PM.

  8. #8
    Registered User
    Join Date
    01-30-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Q: Creating a timeline from a list of events

    An addendum for anyone interested ...

    PeterG suggested a different approach to me; one that does not require any VB. It is attached.

    Matt.
    Attached Files Attached Files

+ 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