Skip to main content

How to count number of cells/rows until first blank in Excel?

Author: Sun Last Modified: 2016-08-19
doc count until first blank 1
For instance, you have a list of data including some blanks in a sheet, and what you want to do is to count the number of cells until blank cell, and the recount the below cells as following screenshot shown. In this article, I introduce formulas to quickly solve this job in Excel.
Count number of cells/rows until blank with formula

Count times a word appears

If you want to count the times a specific word appears in a single cell or a range, you can try Count times a word appears of Kutools for Excel, it may make a big favor for you.
doc formula 1

arrow blue right bubble Count number of cells/rows until blank with formula

Select a blank cell next to the cells you want to count, and enter this formula =MIN(IF(A1:A12="",ROW(A1:A12)-ROW(A1)+1))-1, press Shift + Ctrl + Enter key to get the correct result, and then drag auto fill handle over the cells you need to apply this formula. See screenshot:
doc count until first blank 2


1. You also can also apply this formula =MATCH(1,--(A1:A12=""),0)-1 and press Shift + Ctrl + Enter keys simultaneously to count the cells until a blank cell.

2. In above formulas, A1 is the first cell in the list you want to count, and A1:A12 is the list you want to count from.

doc download 1

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (2)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
How Do i get only the max value? for example in the picture i want it to output only 3 (first set of numbers), then 4(second set after the blanks)

thank you
This comment was minimized by the moderator on the site
Hi Team,
When applying this formula:

I find that it counts the number of rows from the FIRST blank cell not the NEXT blank cell like it does in your example (where the number seems to reset with each blank cell).

Is there an adjustment I need to make for this?
There are no comments posted here yet
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations