+ Reply to Thread
Results 1 to 3 of 3

Count Consecutive Repeating Numbers in One Column

  1. #1
    Forum Contributor
    Join Date
    06-03-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007 / Excel 2010
    Posts
    106

    Count Consecutive Repeating Numbers in One Column

    Hi, looking for some assistance please.

    I’m trying to apply a formula DonkeyOte provided in a different thread to numbers in this case, but it's pretty much the same thing.

    In the current sheet, I’m trying to Count the number of times a “1” or “2” appears consecutively in Column H and output my results to either Column J (if looking for a "1") or Column K (if looking for a "2"). The problem is the formula gives me the incorrect result for the first “2” or “1” it hits in my series. All other values are correct though.

    So an example, if I'm trying to find all the 1's in Column H and I output my results to Column J, the formula I'm using is:

    =IF(OR($H3<>J$1,$H4=$H3),"",COUNTIF($H$3:$H3,J$1)-SUM(J$1:J1))

    The first "1" it hits in Column H, my result in Column J is a "0", where it should be a 1. For the first "2" in Column H, the result in Column K is a "-1" where it should be a 1.

    I've attached a sample of my worksheet in case it's useful.

    Any help on this would really be appreciated.
    Attached Files Attached Files
    Last edited by ExcelQuestFL; 04-06-2011 at 05:58 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Count Consecutive Repeating Numbers in One Column

    Hi,
    You are including the $J$1 cell in the -SUM() element of the formula. J1 is of course the value you are testing for. Change the J3 formula to read

    Please Login or Register  to view this content.
    and copy down. Ditto with column K.

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    06-03-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007 / Excel 2010
    Posts
    106

    Re: Count Consecutive Repeating Numbers in One Column

    Quote Originally Posted by Richard Buttrey View Post
    Change the J3 formula to read
    Please Login or Register  to view this content.
    and copy down. Ditto with column K.
    Ahh that did the trick. Thank you very much!!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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