Results 1 to 7 of 7

Thread: Count consecutive value in a range using formula

  1. #1
    Senior Member LalitPandey87's Avatar
    Join Date
    Sep 2011
    Posts
    222
    Rep Power
    13

    Count consecutive value in a range using formula

    Hi All,

    I have some values in a range in which according to criteria i need to count the continuous occurence of this value.

    For ex.:-

    A B A B A A A B

    and the answer is 3 (A A A) continuous occuring.


    Thanks in Advance

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://eileenslounge.com/viewtopic.php?p=279659#p279659
    https://eileenslounge.com/viewtopic.php?p=279062#p279062
    https://eileenslounge.com/viewtopic.php?p=278940#p278940
    https://eileenslounge.com/viewtopic.php?p=276866#p276866
    https://eileenslounge.com/viewtopic.php?p=276795#p276795
    https://eileenslounge.com/viewtopic.php?p=276983#p276983
    https://eileenslounge.com/viewtopic.php?p=277027#p277027
    https://eileenslounge.com/viewtopic.php?p=277526#p277526
    https://eileenslounge.com/viewtopic.php?p=277523#p277523
    https://eileenslounge.com/viewtopic.php?p=277877#p277877
    https://eileenslounge.com/viewtopic.php?p=278470#p278470
    https://eileenslounge.com/viewtopic.php?p=275430#p275430
    https://eileenslounge.com/viewtopic.php?p=275972#p275972
    https://eileenslounge.com/viewtopic.php?p=276066#p276066
    https://eileenslounge.com/viewtopic.php?p=276065#p276065
    https://eileenslounge.com/viewtopic.php?f=27&t=35521&p=276185#p276185
    https://eileenslounge.com/viewtopic.php?p=276185#p276185
    https://eileenslounge.com/viewtopic.php?p=276185#p276185
    https://eileenslounge.com/viewtopic.php?p=276673#p276673
    https://eileenslounge.com/viewtopic.php?p=276751#p276751
    https://eileenslounge.com/viewtopic.php?p=276754#p276754
    https://eileenslounge.com/viewtopic.php?f=30&t=35100&p=274367#p274367
    https://eileenslounge.com/viewtopic.php?p=274368#p274368
    https://eileenslounge.com/viewtopic.php?p=274370#p274370
    https://eileenslounge.com/viewtopic.php?p=274578#p274578
    https://eileenslounge.com/viewtopic.php?p=274577#p274577
    https://eileenslounge.com/viewtopic.php?p=274474#p274474
    https://eileenslounge.com/viewtopic.php?p=274579#p274579
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 04-05-2024 at 11:56 AM.

  2. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    You mean the maximum continuous occurrence of a given value? Or should the character that is repeating the most continuously should be displayed along with the maximum number?
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #3
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Hi

    Try this array formula

    =MAX(FREQUENCY(IF(A1:H1=J1,COLUMN(A1:H1)),IF(A1:H1 <>J1,COLUMN(A1:H1))))

    Where J1 houses A

    HTH
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  4. #4
    Senior Member LalitPandey87's Avatar
    Join Date
    Sep 2011
    Posts
    222
    Rep Power
    13
    Quote Originally Posted by Excel Fox View Post
    You mean the maximum continuous occurrence of a given value? Or should the character that is repeating the most continuously should be displayed along with the maximum number?

    Yes i mean the maximum continuous occurrence of a value based on criteria.

    For Ex. :-

    A A B A A A A B B C

    In above data range
    if the criteria is "A" then the answer will be 4
    if the criteria is "B" then the answer will be 2
    if the criteria is "C" then the answer will be 1
    Last edited by LalitPandey87; 04-27-2012 at 08:13 AM.

  5. #5
    Senior Member LalitPandey87's Avatar
    Join Date
    Sep 2011
    Posts
    222
    Rep Power
    13
    Quote Originally Posted by Admin View Post
    Hi

    Try this array formula

    =MAX(FREQUENCY(IF(A1:H1=J1,COLUMN(A1:H1)),IF(A1:H1 <>J1,COLUMN(A1:H1))))

    Where J1 houses A

    HTH
    Thanks Admin for your quick response.


    This is exactly what i was lookin for.
    Last edited by LalitPandey87; 04-27-2012 at 08:47 AM.

  6. #6
    Junior Member
    Join Date
    Nov 2012
    Posts
    1
    Rep Power
    0

    Tried the same formula but it didn't work!

    Quote Originally Posted by Admin View Post
    Hi

    Try this array formula

    =MAX(FREQUENCY(IF(A1:H1=J1,COLUMN(A1:H1)),IF(A1:H1 <>J1,COLUMN(A1:H1))))

    Where J1 houses A

    HTH

    Hello,
    I tired the same formula but it I got a #VALUE!

  7. #7
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Hi Al@ICP,

    Welcome to ExcelFox !!

    It's an array formula. So confiirmed with CTRL+SHIFT+ENTER
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. Count Colored Cells Using Excel Formula
    By mahmoud-lee in forum Excel Help
    Replies: 4
    Last Post: 06-15-2013, 11:37 AM
  2. Replies: 1
    Last Post: 12-04-2012, 05:30 PM
  3. counting consecutive values in an array
    By 5ko in forum Excel Help
    Replies: 3
    Last Post: 12-04-2012, 03:49 AM
  4. Replies: 3
    Last Post: 04-08-2012, 09:44 AM
  5. Unique Count on a Filtered Range
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 08-14-2011, 04:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •