+ Reply to Thread
Results 1 to 13 of 13

appears a consecutive series

  1. #1
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    appears a consecutive series

    Can anyone give me the formula for counting consecutive series.
    Question: How many times appears a consecutive series in the same row

    No Item1 Item2 Item3 Item4 Item5 Item6 Item7 Item8 Item9 Item10 Actual result
    1 A A B B B A C 2
    2 100 0 0 200 200 200 11 1
    3 252 131 700 700 151 1
    4 1 1 7 2 2 3 4 4 4 3

    But, ignore zero value or empty cell

    example attached file
    Attached Files Attached Files
    Last edited by Dumy; 07-21-2015 at 02:48 PM. Reason: solved

  2. #2
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: appears a consecutive series

    Here is one way. I created a "duplicated range" that only counted when a value was duplicated along the row regardless of the number of identical items that were in a row.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then sum the 1s created by that duplicated range:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This is how it came together on a worksheet
    There is probably a better way of doing this.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  3. #3
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: appears a consecutive series

    Quote Originally Posted by newdoverman View Post
    Here is one way. I created a "duplicated range" that only counted
    Thank you for your appearance and response.
    This is a solution with extra columns.

    Is there a possibility to solve counting using a single formula in a one cell?

  4. #4
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: appears a consecutive series

    If a value appears consecutively more than once in the same row, should it be counted as 2 occurrences or just one, if just one occurrence then the above formula is perfect, however if it needs to be 2 then --
    =IF(AND(B2=A2,B2<>C2),1,"") this would be enough..
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  5. #5
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: appears a consecutive series

    If you don't want many columns One formula can be
    =SUM(IF(B2:K2=A2:J2,IF(B2:K2<>C2:L2,1,"")))
    in cell M2 copied down..
    However, it an array formula so to use it just press ctrl+shift+enter instead after just enter after pasting this formula in the cell...
    note-this is for the second case i.e. counting twice

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: appears a consecutive series

    Try this

    =SUMPRODUCT(--($B2:$J2=$C2:$K2), --($A2:$I2<>$B2:$J2), --($B2:$J2>0))
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

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

  7. #7
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: appears a consecutive series

    Oops I forgot to skip blanks...however formula by ChemistB is perfect...

  8. #8
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: appears a consecutive series

    Quote Originally Posted by sourabhg98 View Post
    If you don't want many columns One formula can be
    =SUM(IF(B2:K2=A2:J2,IF(B2:K2<>C2:L2,1,"")))
    Thank you for answer
    This array formula does not work well. Returns wrong results

    This is results which I need in M column
    2
    1
    1
    3

  9. #9
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: appears a consecutive series

    Quote Originally Posted by ChemistB View Post
    Try this
    Thank you for answering this is the correct formula for me, my regards

  10. #10
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: appears a consecutive series

    Quote Originally Posted by ChemistB View Post
    Try this
    =SUMPRODUCT(--($B2:$J2=$C2:$K2), --($A2:$I2<>$B2:$J2), --($B2:$J2>0))
    Why this formula does not work on my second example
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: appears a consecutive series

    Can somebody help me?

  12. #12
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: appears a consecutive series

    then use this in AG1-
    =SUMPRODUCT(--($B2:$AE2=$C2:$AF2), --($A2:$AD2<>$B2:$AE2), --($B2:$AE2>0),--($B2:$AE2<>""))
    and copy down..
    Last edited by sourabhg98; 07-21-2015 at 01:11 PM.

  13. #13
    Forum Contributor
    Join Date
    09-10-2010
    Location
    europe
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: appears a consecutive series

    Quote Originally Posted by sourabhg98 View Post
    then use this in AG1- ............and copy down..
    Thank you very much @sourabhg98

+ 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] Longest series of consecutive 2 chars in a string
    By Eric_25 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-23-2014, 06:23 AM
  2. Count Most Consecutive Months a name appears
    By audiofreak in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-17-2013, 02:44 PM
  3. count the series of consecutive positive/negative values and sum them
    By otage in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-12-2012, 12:43 PM
  4. Replies: 2
    Last Post: 10-11-2012, 08:31 AM
  5. Fill series to access same cell on consecutive sheets
    By shellgos in forum Excel General
    Replies: 3
    Last Post: 10-05-2011, 03:25 AM
  6. Loop To count a consecutive series
    By mthpsu in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-24-2011, 02:12 AM
  7. Calculating the largest consecutive gap in a series of numbers
    By Mjau in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-29-2009, 02:55 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