+ Reply to Thread
Results 1 to 24 of 24

Identify sequences of consecutive dates

  1. #1
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Identify sequences of consecutive dates

    Hi,

    I have a spreadsheet of my runs and the dates on which I did them. I am trying to figure out a way to find out where I have done runs on consecutive numbers of dates - I am struggling to come up with a formula to do this. I know that it is likely some sort of FILTER(UNIQUE combined functions that are needed, but haven’t been unable to work it out.
    Master Sheet.png

    - Firstly, I want to list the first occasion where I did runs on two consecutive days.

    - Secondly, I want to list the first occasion where I did runs on three consecutive days.

    - Thirdly, I want to list the first occasion where I did runs on four consecutive days.

    Sheet 4.png

    These will be on three separate worksheets (see image and attachment). I only want each spreadsheet to show anything if at least one sequence has been completed, otherwise leave the coloured cells blank. For illustration I have highlighted the rows in corresponding colours on the data source (first) worksheet.

    I also want the runs to be unique if, possible. i.e. I don’t want the double or triple ones to show the first two and three dates from a quadruple sequence - if this is possible! I think I may need some of helper column to possibly add number sequences for the amount of consecutive dates?

    Here is a link to the file (it’s small and will open quickly): https://1drv.ms/x/s!AtIvkRgReIvwjmUq...5sTJa?e=Ax2jS3

    Also posted on Mr. Excel: https://www.mrexcel.com/board/thread...dates.1209295/

    Thanks in advance!

    Olly.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Identify sequences of consecutive dates

    I add columns F:H.

    H5=IF(E4+1=E5,H4+1,IF(E5+1=E6,1,0))

    After that a pivot table.



    Probably there is an easier solution.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Identify sequences of consecutive dates

    I put this formula into cell GI4, then copied down:

    =IF(AND(E7=E4+3,COUNTIF(C4:C7,C4)=4),"First of four", IF(AND(GI3="",E6=E4+2,COUNTIF(C4:C6,C4)=3),"First of three", IF(AND(GI2="",GI3="",E5=E4+1,COUNTIF(C4:C5,C4)=2),"First of Two","")))

    Then you can extract whatever data you want based on that column not being blank using a simple FILTER function.
    Last edited by Bernie Deitrick; 07-01-2022 at 01:58 PM.
    Bernie Deitrick
    Excel MVP 2000-2010

  4. #4
    Forum Expert
    Join Date
    06-05-2017
    Location
    Brazil
    MS-Off Ver
    Microsoft 365 Version 2404
    Posts
    1,259

    Re: Identify sequences of consecutive dates

    A helper column with this formula, say in GH4, copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Then this formula to return desired results:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Good luck!

  5. #5
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    Thanks, that looks like it will work perfectly. Please could you help with the filter needed in the separate worksheets? I'd like to identify the first instance of each sequence type Thanks soo much for looking at this!

  6. #6
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    Thank you everyone. I will try all of these and confirm which is best for me. Thanks again!

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Identify sequences of consecutive dates

    =FILTER('All Completed Runs'!A1:E1000,'All Completed Runs'!GI1:GI1000<>"")

  8. #8
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    Thanks. This doesn't seem to work for me. .Please see attached.
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Identify sequences of consecutive dates

    I put the summary table on the last new sheet of this file

  10. #10
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    Thanks. I don't think I understand. All I want to do is show the event (venue) and corresponding date for each date sequence. Each separate worksheet should show he sequences as per the manually entered examples. Thanks, sorry for my ignorance.

  11. #11
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Identify sequences of consecutive dates

    All done - same file.

  12. #12
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    Thanks, but it isn't showing correctly for me. I get the below:
    Attachment 785861
    Attachment 785862
    Attachment 785863

    The correct runs they should show are these:
    Attachment 785864
    Attachment 785865

    Not sure if something is going wrong. I want it to list the name of the event (venue) and the date for each of the corresponding runs in each sequence.

    I think your example might be showing the first instance of each separate occasion? What I want to do is just list the each date and venue from the first instance of each type of sequence.

    Thanks again.
    Last edited by ollyhughes1982; 07-02-2022 at 08:35 AM.

  13. #13
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    last image, as could only upload 5:
    Attachment 785868

  14. #14
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Identify sequences of consecutive dates

    @ollyhughes1982

    I get this message when I download the fiel of #13

    vBulletin Message
    Invalid Attachment specified. If you followed a valid link, please notify the administrator

  15. #15
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    It's similar to the two before, but with 4 entries, instead of two or three

  16. #16
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    These are the entries I would expect to see in the three separate worksheets (i.e. Each separate run of the first of each sequence length):
    Attachment 785886
    Attachment 785887
    Attachment 785888

    Thanks.

  17. #17
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    I have now come up with a formula that correctly identifies the streaks and numbers them, in a helper column (column GE).

    Screenshot 2022-07-03 at 13.54.00.png

    The updated file is located here (and attached: 'Headers_v2'): https://1drv.ms/x/s!AtIvkRgReIvwjme2...JPMQZ?e=C0OxBu

    Now, all I need is a formula that will pick up the earliest occurring streak of each type (2, 3 and 4) and enter that earliest streak's event names and dates into each of the relevant 3 worksheets cells.

    I have manually populated the three sheets with the entries I would expect to see. I'm pretty sure it is some sort of filter function I need, but I can't figure it out.

    Thanks!
    Attached Files Attached Files

  18. #18
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Identify sequences of consecutive dates

    Are these not the correct runs for the triple headers?

    First of three.JPG
    Triple headers.JPG

  19. #19
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    Hi. That is right if I wanted to list the first date for each triple header. But, what I want to do is just list the entries within the run for the first time there is a triple header, double header or quadruple header. i.e. List the entries in that sequence. So, when I have achieved the sequence once, that's it, it won't change, as it is recording the first time it was achieved. The challenge is just to do it, rather than list each time I have done it, so I just want to show that first run. Thanks, sorry if I didn't make it clear.

    e.g. 1. The first time I did the double header was between 23/01/2016 and 24/01/2016, so I want to show the events and corresponding dates for that run. (Worksheet: 'All Completed Runs - HDH')

    e.g. 2. The first time I did the triple header was between 13/07/2017 and 15/07/2013, so I want to show the events and corresponding dates for that run. (Worksheet: 'All Completed Runs - HTH')

    e.g. 3. The first time I did the quadruple header was between 25/03/2015 and 28/03/2015, so I want to show the events and corresponding dates for that run. (Worksheet: 'All Completed Runs - HQH')

    So these are the runs I want to display in the separate worksheets.
    Last edited by ollyhughes1982; 07-03-2022 at 10:46 AM.

  20. #20
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Identify sequences of consecutive dates

    I was confused - you were using 'run' meaning 'streak' as well as 'single event' - a run of runs. I have fixed the file now, using three columns of formulas.

  21. #21
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191
    Quote Originally Posted by Bernie Deitrick View Post
    I was confused - you were using 'run' meaning 'streak' as well as 'single event' - a run of runs. I have fixed the file now, using three columns of formulas.
    Thanks for having a look at this. I am out at the moment, so will have a look later or tomorrow. Thank you

  22. #22
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    Hi, that’s brilliant and has now solved my problem. One last issue, is I now want to just provide a summary count of how many times I have done each. Would you be able to show how to do that, please? I have so far set it up as follows:

    Headers WORKING.xlsx

    I have tried the formula below:

    =IF('All Completed Runs'!A4="","",IF(COUNTIF('All Completed Runs'!GE4:GE274,2)>=1,"Yes, "&COUNTIF('All Completed Runs'!GE4:GE274,2),"No"))

    This works for the double headers, as they only go up to 2, but it doesn’t work for the the triple and quadruple-headers, as they also then include the double and triple-headers respectively in their counts. What I need to do is count the maximum number for each sequence and count on that.

    Thanks again for all of your help.

  23. #23
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    Apologies, image didn't upload. Now attached.
    Attachment 786070

  24. #24
    Forum Contributor
    Join Date
    03-30-2020
    Location
    Wales, UK
    MS-Off Ver
    365 (Mac)
    Posts
    191

    Re: Identify sequences of consecutive dates

    I have now resolved this using a helper column as follows:
    =CONCATENATE(GE4,", ",GE5,", ",GE6,", ",GE7)

    This provides a pattern of the four-number sequences (e.g. 1, 2 for a run of 3, 1, 2, 3, 1 for a run of 3 and 1, 2, 3, 4 for a run of 4) and then do a countif for each, using these patterns as criteria.

    Thanks.

+ 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. [SOLVED] Identify consecutive number strings
    By ollyhughes1982 in forum Excel General
    Replies: 9
    Last Post: 03-14-2022, 09:03 AM
  2. Formula for Checking Consecutive Dates and Similar Payments on Consecutive Dates
    By Dark_Knight_897 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-23-2021, 08:34 AM
  3. Formula to identify consecutive month of GP write down
    By jharvey87 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-25-2021, 03:10 PM
  4. detect within the 8 trios in sequences the sequences in the red color
    By jorel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-27-2019, 04:34 PM
  5. Formula to identify consecutive numbers in a large list
    By MadMagz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-15-2019, 07:25 PM
  6. Identify consecutive numbers greater than zero
    By crodonilson99 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-15-2014, 06:13 AM
  7. [SOLVED] Identify the first set of consecutive values
    By lancelee in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-13-2013, 11:13 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