+ Reply to Thread
Results 1 to 8 of 8

Calculating the length, start, and end dates of a series of events

  1. #1
    Registered User
    Join Date
    03-01-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Calculating the length, start, and end dates of a series of events

    I have a data set consisting of two columns: 1) calendar dates and 2) a binary coded event (it's coded as 1 or 2, but could just as easily be 0 and 1). The events alternate in blocks of dates. For example:

    1/1/10 1
    1/2/10 1
    1/3/10 1
    1/4/10 2
    1/5/10 2
    1/6/10 1

    I need to calculate the length (number of days) of each block as well as the start and end date for each block as well as the corresponding event code value.

    Any suggestions would be greatly appreciated.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Calculating the length, start, and end dates of a series of events

    And in your example, the answers would be _____ because _______?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    03-01-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Calculating the length, start, and end dates of a series of events

    I don't understand your question.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Calculating the length, start, and end dates of a series of events

    What is the expected result for your example?

  5. #5
    Registered User
    Join Date
    03-01-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Calculating the length, start, and end dates of a series of events

    Oh...sorry.

    It would be:
    Event #Days Dates
    1 3 1/1/10-1/3/10
    2 2 1/4/10-1/5/10
    1 1 1/6/10-1/6/10

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Calculating the length, start, and end dates of a series of events

    If you use sequential numbers for the events,

    A
    B
    C
    D
    E
    F
    G
    H
    1
    Date
    Event
    Event
    Days
    Start
    End
    2
    01/01/2010
    1
    1
    3
    01/01/2010
    01/03/2010
    F2: =INDEX($A$2:$A$7, MATCH($D2, $B$2:$B$7, 0))
    3
    01/02/2010
    1
    2
    2
    01/04/2010
    01/05/2010
    G2: =INDEX($A$2:$A$7, MATCH($D2, $B$2:$B$7, 1))
    4
    01/03/2010
    1
    3
    1
    01/06/2010
    01/06/2010
    5
    01/04/2010
    2
    6
    01/05/2010
    2
    7
    01/06/2010
    3

  7. #7
    Registered User
    Join Date
    03-01-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Calculating the length, start, and end dates of a series of events

    I can't use sequential numbers for the events. There's about 10,000 lines for each of about 100 files that are in this format.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Calculating the length, start, and end dates of a series of events

    If they just go back and forth, 1-2-1-2-..., you could use a helper column to create sequential numbers.

+ 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. Calculating Amounts per month depending on Start Dates
    By cuadra in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-26-2013, 06:10 PM
  2. [SOLVED] Autofill a formula with a series to start next row at the end of the previous series
    By mbkr29 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-19-2013, 01:20 PM
  3. Excel 2007 : Calculating Quarter Start Dates
    By mlh4041 in forum Excel General
    Replies: 2
    Last Post: 10-19-2009, 10:26 AM
  4. defining a years length(start and end dates)
    By wheefus in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-13-2008, 11:44 AM
  5. identifying start and end dates in a series?
    By RealEstateFinan in forum Excel General
    Replies: 13
    Last Post: 07-15-2007, 07:26 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