Forum Discussion
Count number of blank cells till last non empty cell in a column.
- Mar 20, 2018It does not work because of circular reference problem.
My formula range starts from A1 while you also want to use inside the same range.
To make this work you need to redefjne the starting row of your column A in the formula for example if your start of data starts from A4 then the modified formula should be
=COUNTBLANK(A$4:INDEX(A:A,SUMPRODUCT(MAX((A:A<>"")*ROW(A:A)))))
This should work.
Hi Saurabh,
My suggestion is set the range for one time, and make this range expandable somehow so that if you add a new record, the range expands to include this new record.
The way to do that is to convert the normal range to Table and refer COUNTBLANK to a column in this table!
Please find the attached file to test this suggestion.
- Saurabh KhannaMar 18, 2018Copper Contributor
Thank you Haytham, but unfortunately I will not be able to use this exactly the way in which I want to use.
However, I thought of following but failed on below also, just see if you have solution to my below question if you would have encountered.
I tried capturing the last row number of the non empty cell with the below formula (considering maximum 6000 records that I will have at any time).
=SUMPRODUCT(MAX((A1:A6000<>"")*ROW(A1:A6000)))
Let us assume with above formula I get value as 390.
Now, with above formula I am getting the last non empty row number of a column.
No I want to pass this value from above formula into the Countblank function for the second half but only for the row number.
For example:
Countblank(A1:A390)
In above formula I want to pass 390 number as a result of SUMPRODUCT function used above.
I tried using the INDIRECT function for passing 390 value, but do not want to fix the column name because INDIRECT function requires column name to be fixed.
Thus not able to solve my issue.
Any idea?
- Haytham AmairahMar 18, 2018Silver Contributor
Saurabh,
You can join the value of SUMPRODUCT to the range "A1:A" and then convert the result to an actual range by using INDIRECT as follows:
=COUNTBLANK(INDIRECT("A1:A"&SUMPRODUCT(MAX((A1:A6000<>"")*ROW(A1:A6000)))))
I hope that helps
- Saurabh KhannaMar 19, 2018Copper Contributor
Thank you Haytham, I had tried below formula earlier, and that is the issue which I had mentioned in my previous usage of INDIRECT function that column names are fixed and no longer remains dynamic.
Like in below example column A that is "A1:A" is fixed in this formula under the INDIRECT function. Although this formula works perfectly Ok for column A, but if I want to paste this formula for many other columns then I have to manually change this input under the quotes for every column and that is where I have an issue with this formula, it no longer remains dynamic and does not change column reference when pasting in other columns, if you can guide me on how to resolve this issue, then it perfectly solves my issue :) and I will be very happy to learn this :)
=COUNTBLANK(INDIRECT("A1:A"&SUMPRODUCT(MAX((A1:A6000<>"")*ROW(A1:A6000)))))
- JamilMar 18, 2018Bronze ContributorYou can try taking advantage of Index function
Your dynamic range should be =$A$1:INDEX(A:A,SUMPRODUCT(MAX((A:A<>"")*ROW(A:A))))- JamilMar 18, 2018Bronze ContributorIf you have many formulas then I don’t recommend using INDIRECT function, as it will slowdown your workbook. INDIRECT Is a volatile function.