Excel Formula: Dynamic COUNTA

2Took

Board Regular
Joined
Jun 13, 2022
Messages
203
Office Version
  1. 365
Platform
  1. Windows
Is there a way to replace the "A5000" in below formula such that formula automatically adjusts to however many rows with data, instead of limiting to 5000, but without just putting a million rows?

=COUNTA(A11:A5000)
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Are there likely to be empty rows in the middle of the range? If not then you could use
Excel Formula:
=MATCH("zzz",A:A)-10
assuming text data rather than numeric.
 
Upvote 0
Solution
Are there likely to be empty rows in the middle of the range? If not then you could use
Excel Formula:
=MATCH("zzz",A:A)-10
assuming text data rather than numeric.
Pretty curious formula. It counts the same. Can you explain it, the part with "-10" at least?
 
Upvote 0
The approximate match looks for the last row containing data. Then you subtract 10 for the rows at the top which are not included in the count (A1:A10).
 
Upvote 0
The approximate match looks for the last row containing data. Then you subtract 10 for the rows at the top which are not included in the count (A1:A10).
That makes sense. And if there would likely be empty rows in the middle of the range, what formula would you go with?
 
Upvote 0
The approximate match looks for the last row containing data. Then you subtract 10 for the rows at the top which are not included in the count (A1:A10).
  1. That makes sense. And if there would likely be empty rows in the middle of the range, what formula would you go with?
  2. Tried to incorporate your solution to =SUBTOTAL(103,A11:A5000) with =SUBTOTAL(103,(MATCH("zzz",A:A)-10)) and =MATCH("zzz",SUBTOTAL(103,A:A)), but got below XL responses respectively. What is the way to incorporate it correctly?
2022-11-22_06h57_05.png


2022-11-22_07h02_28.png
 
Upvote 0
With empty rows, just go with what you had originally on an oversize range.

Using COUNTA on ~1million rows will take less processing effort than trying to resize the range that the formula uses.
 
Upvote 0
With empty rows, just go with what you had originally on an oversize range.

Using COUNTA on ~1million rows will take less processing effort than trying to resize the range that the formula uses.
Tried to incorporate your solution to =SUBTOTAL(103,A11:A5000) with =SUBTOTAL(103,(MATCH("zzz",A:A)-10)) and =MATCH("zzz",SUBTOTAL(103,A:A)), but got below XL responses respectively.
What is the way to incorporate it correctly?

2022-11-22_06h57_05.png


2022-11-22_07h02_28.png
 
Upvote 0
There is no correct way, i did say in my previous reply what you need to do and it didn't involve subtotal or match.
 
Upvote 0

Forum statistics

Threads
1,216,136
Messages
6,129,084
Members
449,485
Latest member
greggy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top