+ Reply to Thread
Results 1 to 2 of 2

Count number a times a specific value appears consecutively.

  1. #1
    Registered User
    Join Date
    01-03-2013
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    1

    Count number a times a specific value appears consecutively.

    Would like a function formula that counts the number a times a specific value appears consecutively in a specific column.

    Ex. In column H62:H96, the values appear (vertically):
    1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0

    I would like a formula i could drag across multiple columns that calculates the number of times the value '1' appears consecutively. However, i dont want it to count every time it appears consecutively, only the time it appears the most. For example, the above sequence would yield a value of 7 because the number 1 appeared 7 times in a row at its max.

    Thank you!

  2. #2
    Forum Guru Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Count number a times a specific value appears consecutively.

    Try this array formula**:

    =MAX(FREQUENCY(IF(H62:H96=1,ROW(H62:H96)),IF(H62:H96<>1,ROW(H62:H96))))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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