+ Reply to Thread
Results 1 to 33 of 33

Count highest number of times a number is in a row consecutively

  1. #1
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Count highest number of times a number is in a row consecutively

    I have a column of data. The data has a number or "UR" in every cell. There are no blank cells. I need to know the most number of times a number is represented in the cell? The data flows from top to bottom

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Count highest number of times a number is in a row consecutively

    Are you still using Excel 2010?


    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Re: Count highest number of times a number is in a row consecutively

    I'm using Excel 2021

  4. #4
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Re: Count highest number of times a number is in a row consecutively

    I am attempting to attach a sample spreadsheet.
    Attached Files Attached Files

  5. #5
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Count highest number of times a number is in a row consecutively

    Please try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Count highest number of times a number is in a row consecutively

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Count highest number of times a number is in a row consecutively

    For the most frequent number:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Re: Count highest number of times a number is in a row consecutively

    I want the highest number of times numbers are uninterrupted by "UR" in the column

  9. #9
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Re: Count highest number of times a number is in a row consecutively

    THIS DID IT!!! Thank you HansDouwe. This was exactly what I was looking for

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Count highest number of times a number is in a row consecutively

    Looks like your requirement has changed.

    I have a column of data. The data has a number or "UR" in every cell. There are no blank cells. I need to know the most number of times a number is represented in the cell? The data flows from top to bottom
    Your new request is beyond me. I will declare myself out.

  11. #11
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Count highest number of times a number is in a row consecutively

    Thanks for the feedback. Glad to have helped. .

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

  12. #12
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: Count highest number of times a number is in a row consecutively

    One more (compact) method that you can consider...

    =MAX(LEN(TEXTSPLIT(TRIM(CONCAT(IF(ISNUMBER(A1:A99),"X"," ")))," ")))
    Last edited by Rick Rothstein; 12-14-2023 at 01:51 AM.

  13. #13
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Re: Count highest number of times a number is in a row consecutively

    I tried: =MAX(LEN(TEXTSPLIT(TRIM(CONCAT(IF(ISNUMBER(I:I),"X"," ")))," ")))

    I got back "the formula contains unrecognized text"

  14. #14
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: Count highest number of times a number is in a row consecutively

    Quote Originally Posted by hammerb View Post
    I tried: =MAX(LEN(TEXTSPLIT(TRIM(CONCAT(IF(ISNUMBER(I:I),"X"," ")))," ")))

    I got back "the formula contains unrecognized text"
    Sorry, I thought xl2021 had the TEXTSPLIT function available, but in checking, I now see it doesn't. While my formula works in xl365 (what I have), it will not work in your version of Excel. I am a little surprised that Microsoft would not have included all of the older xl365 function into xl2021, but they apparently didn't.

  15. #15
    Registered User
    Join Date
    06-04-2018
    Location
    Europe
    MS-Off Ver
    Office365
    Posts
    78

    Re: Count highest number of times a number is in a row consecutively

    Try:

    =MODE(A1:A13)
    0r
    =MODE.MULT(A1:A13)

  16. #16
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,416

    Re: Count highest number of times a number is in a row consecutively

    See if this formula works for you (change the A1:A500 range to your actual range of values)...
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by Rick Rothstein; 12-15-2023 at 12:05 PM.

  17. #17
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Re: Count highest number of times a number is in a row consecutively

    Quote Originally Posted by Tommy90 View Post
    Try:

    =MODE(A1:A13)
    0r
    =MODE.MULT(A1:A13)
    I'm not sure what this formula is doing. It returned "3" which is not right. It should be 13

  18. #18
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Re: Count highest number of times a number is in a row consecutively

    Quote Originally Posted by Rick Rothstein View Post
    See if this formula works for you (change the A1:A500 range to your actual range of values)...
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I treid this formula. I changed A1:A500 to I:I and it displayed "#NAME?" "The formula contains unrecognized text"

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,980

    Re: Count highest number of times a number is in a row consecutively

    Tommy90's is not what you asked for - it returns the value that appears most in the list.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,980

    Re: Count highest number of times a number is in a row consecutively

    Rick's uses TEXTSPLIT - that's not available in Excel 2021.
    Last edited by AliGW; 12-15-2023 at 12:20 PM. Reason: Typo fixed.

  21. #21
    Banned User!
    Join Date
    05-03-2022
    Location
    HumptyDoo, Australia
    MS-Off Ver
    365
    Posts
    101

    Re: Count highest number of times a number is in a row consecutively

    Can you tell us why you are still going with this when, in post #9, you said "This was exactly what I was looking for"?

  22. #22
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Re: Count highest number of times a number is in a row consecutively

    I originally made 2 posts for 2 separate requests for help. The 2 requests were very similar but different. A forum moderator closed my second request because they incorrectly thought that that request was the exact same thing as this request. They are in fact separate. I have no means of contacting the moderator to inform them of the error. SO instead I moved my second request to this thread in hopes of finding a solution to my second request.

    And my second request for help is this: I have a column of numbers (Column I). old data at the top of the column. recent data at the bottom of the column. The numbers are interrupted by "UR" on a few random cells. I would like a formula that will show me how many consecutive cells of data, from bottom to top, have a number in them before being interrupted by the lowest "UR" cell.

  23. #23
    Banned User!
    Join Date
    05-03-2022
    Location
    HumptyDoo, Australia
    MS-Off Ver
    365
    Posts
    101

    Re: Count highest number of times a number is in a row consecutively

    If your data is in column I try something like this;

    =LOOKUP(2,1/(I1:I9999="UR"),ROW(I1:I9999))-SMALL(IF(I1:I9999="UR",ROW(I1:I9999)),COUNTIF(I1:I999,"UR")-1)-1

    This will give you the number of cells between the last "UR" and the 2nd last "UR". Is that what you want?
    Last edited by GameChanger; 12-15-2023 at 08:03 PM.

  24. #24
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Re: Count highest number of times a number is in a row consecutively

    no. You are very close though. I want the number of cells that contain a number between the last UR and the bottom of the column.

  25. #25
    Banned User!
    Join Date
    05-03-2022
    Location
    HumptyDoo, Australia
    MS-Off Ver
    365
    Posts
    101

    Re: Count highest number of times a number is in a row consecutively

    Then;
    =MAX(IF(ISBLANK(I1:I9999),0,ROW(I1:I9999)))-LOOKUP(2,1/(I1:I9999="UR"),ROW(I1:I9999))

  26. #26
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Re: Count highest number of times a number is in a row consecutively

    Perfect. Thank you GameChanger for answering one of my questions.

    Thank you to HansDouwe for answering the other question.

    You have both made my sports stats look awesome.

  27. #27
    Banned User!
    Join Date
    05-03-2022
    Location
    HumptyDoo, Australia
    MS-Off Ver
    365
    Posts
    101

    Re: Count highest number of times a number is in a row consecutively

    No problems.

  28. #28
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Count highest number of times a number is in a row consecutively

    Maybe this as an alternative:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  29. #29
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Count highest number of times a number is in a row consecutively

    Or a small adjustment in Trevor's formula if your data not start at row 1:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  30. #30
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,980

    Re: Count highest number of times a number is in a row consecutively

    Quote Originally Posted by hammerb View Post
    I have no means of contacting the moderator to inform them of the error. SO instead I moved my second request to this thread in hopes of finding a solution to my second request.
    You can PM any moderator if you think they have closed a thread in error. Did you try to PM the moderator in question?

  31. #31
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: Count highest number of times a number is in a row consecutively

    @Hans: thanks for the tweak, but it shouldn't matter provided there is a header in row 1 (that is, no blanks in column A).

    I have a column of data. The data has a number or "UR" in every cell. There are no blank cells. I need to know the most number of times a number is represented in the cell? The data flows from top to bottom
    To be fair, I still don't think this accurately describes the requirement.

    Nor this:
    I want the highest number of times numbers are uninterrupted by "UR" in the column
    That could be before the "UR".

    This is what made sense (after reading it a few times):
    And my second request for help is this: I have a column of numbers (Column I). old data at the top of the column. recent data at the bottom of the column. The numbers are interrupted by "UR" on a few random cells. I would like a formula that will show me how many consecutive cells of data, from bottom to top, have a number in them before being interrupted by the lowest "UR" cell.
    Given that you and others offered solutions, I guess it's just me.

  32. #32
    Registered User
    Join Date
    09-26-2011
    Location
    Missouri, America
    MS-Off Ver
    Excel 2021
    Posts
    32

    Re: Count highest number of times a number is in a row consecutively

    yes. it was kind of a difficult thing to describe. Thanks again for your help

  33. #33
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,980

    Re: Count highest number of times a number is in a row consecutively

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

+ 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] Count number of times a 6 digit number show up in a cell - with a dup check
    By fireguy7 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-21-2020, 08:51 AM
  2. Determining how many times a number occurs consecutively
    By happyladyfromca in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-06-2018, 01:05 PM
  3. [SOLVED] Count number of times a number appears with count start from next cell of last occurr
    By lesliewheeler in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-29-2018, 09:34 AM
  4. [SOLVED] Count the number of times an A appears 5 or more times consecutively
    By CCook310 in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 10-02-2013, 04:02 PM
  5. Count number of times when data is highest among a column
    By arrontan in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-20-2013, 06:10 AM
  6. Count number a times a specific value appears consecutively.
    By kww0027 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-03-2013, 06:17 PM
  7. Can excel consecutively number a cell? EX: consecutively number a.
    By sargon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2005, 05:06 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