+ Reply to Thread
Results 1 to 5 of 5

Count number of consecutive non blank cells in a column macro excel

  1. #1
    Registered User
    Join Date
    08-05-2013
    Location
    borazjan
    MS-Off Ver
    Excel 2007
    Posts
    50

    Count number of consecutive non blank cells in a column macro excel

    hi,
    how to Count number of consecutive non blank cells in a column by macro in excel?

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Count number of consecutive non blank cells in a column macro excel

    Assuming you want the highest number of consecutive non-blank cells in a column
    (for example, if there's 2 non blank cells in D1 and D2, then D3 is empty, but D4:D8 isn't, you want to show "5" for D4,D5,D6,D7 and D8)

    Example code for column D.
    Please Login or Register  to view this content.
    Please click the * below if this helps

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Count number of consecutive non blank cells in a column macro excel

    Or

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Count number of consecutive non blank cells in a column macro excel

    Hi Sixthsense,

    doesn't that count all the filled cells, not specifically the consecutive ones?

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Count number of consecutive non blank cells in a column macro excel

    Quote Originally Posted by JasperD View Post
    doesn't that count all the filled cells, not specifically the consecutive ones?
    Hm... I missed that part and thanks for the correction

    Could you please let me know what is the OP's expected output for the below data (For example)

    D
    1
    2
    5
    3
    5
    4
    5
    5
    6
    7
    8
    4
    9
    4
    10
    11
    6
    12
    6
    13
    6
    14
    6
    15
    6
    16
    17
    1
    18
    19
    20
    21

+ 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. Replies: 6
    Last Post: 10-29-2014, 05:02 PM
  2. Count number of cells in column per month, ignore blank cells
    By lamdl in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-13-2014, 08:50 PM
  3. Replies: 2
    Last Post: 07-25-2013, 01:01 PM
  4. 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
  5. Replies: 2
    Last Post: 09-01-2010, 07:48 AM

Tags for this Thread

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