We help IT Professionals succeed at work.

Excel - Lock a range in an array formula

billb1057
billb1057 asked
on
I'm not sure how to explain this, but the attached file shows an array formula that finds the first text cell in a column and returns the row number.
The problem I'm trying to solve is to lock the range as the entire column, so if any rows are deleted the range doesn't automatically get smaller.
Usually, I would set the range as the column like sum(a:a) and that sums everything in column a.  If you delete a row, it still gets the whole column.
With this array formula though, it doesn't like the use of that range.
Even if you set the range manually for a1:a65536 it doesn't seem to work.
If the range is set from a2:65536 or a1:65535, then the formula works.
But in those cases, if you delete a row, the range shrinks by one.

Any ideas on how to solve this?  Thanks.
Set-range-in-array.xls
Comment
Watch Question

Most Valuable Expert 2013
Commented:
Hello billb1057,
Yes, you can't use a whole column in an array formula like that (not in Excel 2003 or earlier, anyway, you can in Excel 2007).
You could "fix" the range using INDIRECT, i.e.
=MIN(IF(ISTEXT(INDIRECT("data!A1:A65535")),ROW(INDIRECT("data!A1:A65535"))))
or you could use MATCH like this
=MATCH(TRUE,ISTEXT(INDIRECT("data!A1:A65535")),0)
confirmed with CTRL+SHIFT+ENTER
regards, barry

Author

Commented:
Barry - thanks.  Both of those worked.  Would you know which one might calculate faster (if either does)?  
Most Valuable Expert 2013

Commented:
I imagine that the MATCH version will be quicker......
regards, barry

Author

Commented:
That is great - thanks again.
Bill B