You are here:

Excel/Count non blank row from a particular row

Advertisement


Question
QUESTION: Hi Jerry,

I need your assistance to identify a macro that will count non blank row from a particular row to the next blank row in the middle of the sheet. Sample below

      [Column A]
[Row 1] Not Needed
[Row 2] Not Needed
[Row 3] Blank Cell
[Row 4] Needed
[Row 5] Needed
[Row 6] Needed
[Row 7] Needed
[Row 8] Blank Cell
[Row 9] Not Needed
[Rw 10] Not Needed
[Row 7] Not Needed

In the example above I want to count starting A4 to the next blank cell, so it should return 4.

Thanks in advance

ANSWER: We would need logic that a macro or formula can detect.

What is it that makes rows 4-7 needed?
What is it that makes rows 1-2 and 9-11 not needed?



---------- FOLLOW-UP ----------

QUESTION: Starting row is fixed it always starts at A4, the macro shoul count non blank row from A4 in this case the next blank row is A8 thus the macro should only count a4 to a7

Answer
No macro needed, this can be done with an array formula:


=MIN(IF($A$4:$A$100="", ROW($A$4:$A$100), ""))-4

...confirm that formula in a cell by pressing CTRL-SHIFT-ENTER to activate the array.  You will know the array is active by the curly braces { } that will appear around your formula and your answer will appear.   If you just press ENTER you will get a #Value error.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

All Answers


Answers by Expert:


Ask Experts

Volunteer


Jerry Beaucaire

Expertise

Excel Formulas, macros, automation. Microsoft Excel MVP - 2010. Code site with free code snippets and techniques: http://sites.madrocketscientist.com/jerrybeaucaires-excelassistant/files

Experience

Microsoft Excel MVP - 2010. I have my own extensive Excel help/code site: http://sites.madrocketscientist.com/jerrybeaucaires-excelassistant/files ===================== I have been offering free assistance as an Excel aid on many web sites for many years: (http://www.excelforum.com - JBeaucaire) ======== (http://www.askmehelpdesk.com/spreadsheets - JBeaucaire) ======= (http://www.mrexcel.com/forum - jbeaucaire)

Education/Credentials
Bachelor's Degree from Azusa Pacific University in Mathematics and Music Composition

Awards and Honors
Microsoft Excel MVP 2010

©2016 About.com. All rights reserved.