+ Reply to Thread
Results 1 to 10 of 10

Max consectutive values in a block of columns and rows

  1. #1
    Registered User
    Join Date
    11-10-2005
    Location
    Scotland
    Posts
    69

    Max consectutive values in a block of columns and rows

    Hello again

    I have a range of data which is 9 columns wide with rows which keep getting added to. I need a function that will report the most consecutive occurences of a particular value. There are only two values in the data entry A or B, but the consecutive nature of the values runs accross the rows. Also, the data may be blank which should just be ignored.

    So for example:

    A A A B B A
    A A B A B B A A A
    A A A
    B A A B
    A B B B B A A B A

    The answer should report A=6 and B=4

    Thanks again

    Craig
    Last edited by craigproudfoot; 08-30-2012 at 06:24 PM.

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Max consectutive values in a block of columns and rows

    I could get you consecutive values in each row and a MAX of that, however if MAX consecutive values are across rows (as for 'B') its a bit of a struggle. Can you have your data rearranged to a single row or column?

    See attached
    Attached Files Attached Files
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Registered User
    Join Date
    11-10-2005
    Location
    Scotland
    Posts
    69

    Re: Max consectutive values in a block of columns and rows

    Hello
    Thanks for coming back to me.
    I could seperate into a single column potentially if it won't work any other way. Is there a quick way to arrange into a single continouos column from the row format I have? I have potentially 300 rows.

    Craig

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Max consectutive values in a block of columns and rows

    Easily done with a little help from
    http://chandoo.org/forums/topic/tran...nto-one-column

    See attached. Does this work for you?
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-10-2005
    Location
    Scotland
    Posts
    69

    Re: Max consectutive values in a block of columns and rows

    Almost works Ace_XL

    When the rows are transposed to a single column using a formula, how can you get it to skip the blanks at the end of some of the rows?

  6. #6
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Max consectutive values in a block of columns and rows

    In case there are blanks at the end (or in between) rows, the single column will display a 0 as a corresponding value.

    The current array formula that determines the max number of consecutives ignores zeros (and hence blanks from the original data too!), so a "AAA A" sequence would be read as 4 consecutive A's

    If you want the blanks to be considered as breaking the consecutiveness and "AAA A" to be read as 3 consecutive A's only, change the array formulas to
    Please Login or Register  to view this content.
    Last edited by Ace_XL; 08-30-2012 at 08:14 PM.

  7. #7
    Registered User
    Join Date
    11-10-2005
    Location
    Scotland
    Posts
    69

    Re: Max consectutive values in a block of columns and rows

    Thanks again Ace

    I am trying to adapt your last workbook using my data range, but I must be making mistakes as the transpose doesn't seem to be working properly.

    I have attached an extract showing my actual data range - 9 columns wide x 300 rows. I wonder if anyone would be kind enough to adapt Ace's solution to my data range.

    NB The data range is made up of Ps, Hs and blanks as oppose to As, Bs and blanks.

    Many thanks

    Craig
    Attached Files Attached Files

  8. #8
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Max consectutive values in a block of columns and rows

    Does the attached work for you?

    I havent checked the results though
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    11-10-2005
    Location
    Scotland
    Posts
    69

    Re: Max consectutive values in a block of columns and rows

    Fantastic - that worked perfectly. Thank you for your time and effort.
    Have clicked your star.

    Craig

  10. #10
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Max consectutive values in a block of columns and rows

    @ craigproudfoot

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

+ 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