+ Reply to Thread
Results 1 to 4 of 4

Count Consecutive Cell Matches

  1. #1
    Registered User
    Join Date
    11-01-2018
    Location
    Pennsylvania, United States
    MS-Off Ver
    Office 365 Pro Plus
    Posts
    2

    Count Consecutive Cell Matches

    Good evening all,

    I'm trying to create a formula to count the consecutive number of matches in a row of data. I've attached a copy of a template spreadsheet showing similar data for reference. The data is recorded data from some plant systems and taken in 1 minute increments. I'm trying to get a formula to see how many minutes the "steps" are taking. I've done the countif to get total number of say values with "3" but I'm looking to break down how long the "3s" repeat themselves and for each occurrence. So for example, in cells C2:C2762, the number "1" is present 45 times (or for 45 minutes) and I'd like to find out how long each stretch occurs. So is it 3 stretches for 15 cells each or 5 stretches for 9 cells, etc.

    Hopefully that kind of makes sense but I can't wrap my head around the formula for finding that breakdown. If this was only for a few days of data it would suck but I could do it manually however this is for 4 months of data at 1440 rows per day.

    Thanks for any help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Count Consecutive Cell Matches

    Hi

    one of the forum gurus may be able to do this with formulas, but I have resorted to a macro.

    This macro displays an inputbox for you to enter the value to check, then returns a message box with the number of sequences of that value and the number of times it occurs. It can very easily be tweaked to put the values in particular cells, if you prefer.

    Please Login or Register  to view this content.

  3. #3
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Count Consecutive Cell Matches

    Please try at
    J2 drag down

    =IFERROR(INDEX($C$2:$C$2762,MATCH(0,INDEX(COUNTIF(J$1:J1,$C$2:$C$2762),),)),"")

    K2 Press Ctrl+Shift+Enter drag to O2 and drag down

    =IFERROR(1/(1/LARGE(FREQUENCY(IF($C$2:$C$2762=J2,ROW($C$2:$C$2762)),IF($C$2:$C$2762<>J2,ROW($C$2:$C$2762))),COLUMNS($K2:K2))),"")
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-01-2018
    Location
    Pennsylvania, United States
    MS-Off Ver
    Office 365 Pro Plus
    Posts
    2

    Re: Count Consecutive Cell Matches

    Thanks Nicky and Bo. I used both and they worked awesome for sorting through the 240k rows of data I had. I appreciate the help.

    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] Vlookup consecutive matches
    By MJetter in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-02-2018, 03:54 AM
  2. [SOLVED] How to Count a Cell if It matches
    By paulepage14 in forum Excel General
    Replies: 3
    Last Post: 01-16-2018, 04:44 PM
  3. Count consecutive cell until blank and change the cell color.
    By JuauM in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-09-2017, 03:36 AM
  4. [SOLVED] Count Consecutive Colored Cell Ranges
    By Logit in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-19-2017, 04:46 PM
  5. How do you count consecutive values backward from the last cell?- Please help!
    By asseenontv in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-26-2015, 02:58 PM
  6. [SOLVED] Count number of occurrences but if there are consecutive matches count them as one
    By michaljireht in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-26-2013, 08:26 PM
  7. Count.If if value in other cell in the row matches
    By Dudgeon in forum Excel General
    Replies: 4
    Last Post: 08-27-2011, 04:32 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