+ Reply to Thread
Results 1 to 7 of 7

I need to count consecutive values in a row that is interspersed with blank cells

  1. #1
    Registered User
    Join Date
    10-28-2014
    Location
    France
    MS-Off Ver
    Mac Excel 2011
    Posts
    4

    I need to count consecutive values in a row that is interspersed with blank cells

    Greetings Everyone!

    This is my first time; please be gentle. Does anyone know how I can count (within a row) the largest number of consecutive cells that are not blank? For instance, among multiple rows of data, row 1 has 10 consecutive cells that aren't blank, row 2 has 15, row 3 has 12, etc. I have hundreds of rows and the blanks are never in the same place. "Count" is returning the total number of cells that have values, but not the maximum number of consecutive values with in that row; that is what I need.

    I have attached a sampling.

    Thanks in advance!!

    -m
    Attached Files Attached Files

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: I need to count consecutive values in a row that is interspersed with blank cells

    My impressions are that this is going to require a VBA / macro solution.

    With that in mind you might do well if you contact one of the ExcelForum moderators and request they move your thread to that section.

    Hope this helps.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: I need to count consecutive values in a row that is interspersed with blank cells

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    S
    T
    U
    V
    W
    X
    Y
    Z
    AA
    AB
    AC
    AD
    AE
    1
    TIME
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    2
    Sample X1
    801
    796
    761
    713
    652
    5
    3
    Sample X2
    662
    637
    585
    3
    4
    Sample X3
    116
    566
    534
    497
    484
    451
    5
    5
    Sample X4
    519
    1
    6
    Sample X5
    599
    601
    588
    564
    543
    503
    467
    7
    7
    Sample X6
    577
    676
    733
    711
    660
    639
    621
    576
    555
    534
    502
    468
    454
    440
    428
    419
    401
    393
    383
    375
    370
    365
    360
    357
    354
    25
    8
    Sample X7
    118
    117
    113
    114
    109
    106
    106
    7
    9
    Sample X8
    -194
    -211
    2
    10
    Sample X9
    672
    685
    693
    673
    633
    588
    533
    7
    11
    Sample X10
    798
    622
    701
    722
    782
    823
    798
    766
    686
    644
    601
    563
    11
    12
    Sample X11
    552
    566
    618
    590
    556
    523
    490
    7
    13
    Sample X12
    660
    671
    680
    664
    637
    592
    563
    523
    8


    In AE2, confirmed with Ctrl+Shift+Enter and then copied down,

    =MAX(FREQUENCY(IF(B2:AC2<>"", COLUMN(C2:AD2)), IF(B2:AC2="", COLUMN(B2:AD2))))
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: I need to count consecutive values in a row that is interspersed with blank cells

    @shg
    Good one. The offset columns idea never occurred to me. Thanks for sharing this one.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: I need to count consecutive values in a row that is interspersed with blank cells

    In response to PM about posting BBCode (not HTML): The add-in is at https://app.box.com/s/soezox25h3w0q5s4rcyl

  6. #6
    Registered User
    Join Date
    10-28-2014
    Location
    France
    MS-Off Ver
    Mac Excel 2011
    Posts
    4

    Thumbs up Re: I need to count consecutive values in a row that is interspersed with blank cells

    Thanks so much SHG!! This worked perfectly!!

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: I need to count consecutive values in a row that is interspersed with blank cells

    You're welcome.

+ 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. Formula to Count Consecutive Blank Cells in a Range Depending on Today's Date
    By tophatpete in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 11-28-2020, 05:12 AM
  2. Replies: 2
    Last Post: 07-25-2013, 01:01 PM
  3. Macro to count consecutive blank cells and assign a number
    By voitoosh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-08-2013, 03:24 AM
  4. Replies: 4
    Last Post: 01-15-2012, 12:42 PM
  5. Replies: 2
    Last Post: 09-01-2010, 07:48 AM

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