+ Reply to Thread
Results 1 to 5 of 5

Return Max Number of Consecutive Occurences of '4' or More

  1. #1
    Forum Contributor
    Join Date
    01-04-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    179

    Return Max Number of Consecutive Occurences of '4' or More

    Greetings all. It's been a while since I've posted.

    I have a column of data that contains numbers between 0 and 5. I currently found a formula that will provide me with the max number of consecutive appearances of the number 5. See below:
    Please Login or Register  to view this content.
    I am looking to change this code subtly, so that it includes consecutive occurrences of 4 OR 5. e.g.

    3
    4
    4
    5
    4
    3
    3
    4
    5
    3

    Would return 4, since I have 2 4's, a 5 and then another 4 and it is the highest run of this in the column. Can anyone help? All advice is much appreciated.
    Did I help? Click *- add to my rep.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Return Max Number of Consecutive Occurences of '4' or More

    Hi.

    =MAX(FREQUENCY(IF(MMULT(0+('Utilisation Sheet'!AE10:AE57={4,5}),{1;1}),ROW('Utilisation Sheet'!AE10:AE57)),IF(MMULT(0+('Utilisation Sheet'!AE10:AE57<>{4,5}),{1;1})=2,ROW('Utilisation Sheet'!AE10:AE57))))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Return Max Number of Consecutive Occurences of '4' or More

    alternative
    =MAX(FREQUENCY(IF('Utilisation Sheet'!AE10:AE57<=5,IF('Utilisation Sheet'!AE10:AE57>=4,ROW('Utilisation Sheet'!AE10:AE57))),IF('Utilisation Sheet'!AE10:AE57<>4,IF('Utilisation Sheet'!AE10:AE57<>5,ROW('Utilisation Sheet'!AE10:AE57)))))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Contributor
    Join Date
    01-04-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2010
    Posts
    179

    Re: Return Max Number of Consecutive Occurences of '4' or More

    Quote Originally Posted by martindwilson View Post
    alternative
    =MAX(FREQUENCY(IF('Utilisation Sheet'!AE10:AE57<=5,IF('Utilisation Sheet'!AE10:AE57>=4,ROW('Utilisation Sheet'!AE10:AE57))),IF('Utilisation Sheet'!AE10:AE57<>4,IF('Utilisation Sheet'!AE10:AE57<>5,ROW('Utilisation Sheet'!AE10:AE57)))))
    Thanks Martin and XOR LX. Both solutions works great.

    Don't mean to be a pain, but do you have a solution for if this was 3, 4 OR 5, not just 4 or 5?

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Return Max Number of Consecutive Occurences of '4' or More

    oops wrong answer
    Last edited by martindwilson; 11-14-2014 at 12:40 PM.

+ 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] return the number of cells with the most consecutive specific values.
    By Bab1 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-13-2014, 07:11 AM
  2. How to Count the # of consecutive occurences >2 in a row of data
    By bparrott in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-29-2013, 05:03 PM
  3. How do I count the number of consecutive occurences within a data range?
    By PhDScience in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 08-07-2013, 11:01 PM
  4. Count Consecutive Occurences
    By ctrapper in forum Excel General
    Replies: 1
    Last Post: 11-17-2009, 11:51 AM
  5. [SOLVED] Return Row Number of LAST Numeric Consecutive Duplicate in Column
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-06-2006, 11:25 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