refer formula to specific cell

Ian Bell
Ian Bell used Ask the Experts™
I would like to have the below formula modified to refer to a range of cells.
The above range shows a9:a2473. However the end range can change from sheet to sheet.
row 9 is always the same. The latter part only needs modifying from Countif.....
At the moment the other cell formulas just refer to a cell with 2473 or whatever number of rows there are in the sheet
and I would like to do the same with the above formula rather than having to modify each time.
Any help much appreciated.
Thank You
ps..... or maybe there is a formula that can refer to the last row of a spreadsheet
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015
Try this.....

=IF(A9=A8,T8,S9+COUNTIF(INDIRECT("A9:" & "A"&MAX(INDEX(ROW($1:$50000)*($A$1:$A$50000<>""),0))),A9)-1)

Open in new window

The formula assumes 50000 as the max possible row with data in column A. Change it as per your requirement.

Use the Name Manager to define a commonly named range for each sheet using worksheet scope, setting the range appropriately for each tab. Then reference Tab!Named Range in your formula. You might instead set each data range as a Table and reference the table and header in your formula to replace the cell range in the count if portion.
Ian Bellretired


Thanks Sktneer, works perfectly.
Also thanks to Doug but the explanation was way over my head..
I will post another related formula I'd like help with

Thanking You


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial