+ Reply to Thread
Results 1 to 5 of 5

How to count cells until first non-blank cell

  1. #1
    Registered User
    Join Date
    02-08-2009
    Location
    Bridgwater, UK
    MS-Off Ver
    Excel 2003
    Posts
    17

    How to count cells until first non-blank cell

    So what I have is an unknown number of rows, starting at row 2. The first row (row 2) contains information from A2:M2 but all rows after this in column M will be blank up to a particular row. What I want to do, is count how many rows are blank in the column M up to the last blank cell and fill this with a specific word.

    I have attached a basic layout workbook to show what I want.

    There is a comment on cell M3

    TIA
    Attached Files Attached Files
    Last edited by FoxIII; 02-17-2009 at 07:56 AM.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: How to count cells until first non-blank cell

    Using your posted example...
    Try this:

    • Select M2:M6
    • From the Excel Main Menu:
    ...Edit.Go_To
    ...Click: Special Cells
    ...Check: Blank
    ...Click: OK

    While only the blank cells are selected:
    ...Type: =
    ...Press the UP arrow
    ...Hold down CTRL and Press ENTER

    Now each (formerly) blank cells displays that previous value from above.

    To hardcode them:
    • Select M2:M6
    • CTRL+C ....a shortcut for Edit.Copy
    • Edit.Paste_Special...Check: Values....Click: OK

    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    02-08-2009
    Location
    Bridgwater, UK
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: How to count cells until first non-blank cell

    Thanks Ron! That worked perfectly.

  4. #4
    Registered User
    Join Date
    06-15-2011
    Location
    Timbucctoo
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: How to count cells until first non-blank cell

    Hi Ron

    I found your answer to "counting to the first non-blank cell" posted on 15 Feb 2009 almost what I want. However my problem is that I need to count across each column in my table to find how many weekd (i.e. blank cells) since the last order, e.g in a range from H6..CZ6 to return to me the number of blanks before the first cell with data (i.e. last order).

    I thought I would be clever by substituting RIGHT arrow in your formula but without success.

    Can you help please

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: How to count cells until first non-blank cell

    bonviveur60,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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