Got any Excel/VBA Questions? Free Excel Help
To increment a formula reference by rows, when copying across columns you need a combination of the INDIRECT and ADDRESS Function. For example, place this formula in any row in Column "D".
=SUM(INDIRECT(ADDRESS(1,1)&":"&ADDRESS(COLUMN()-2,1)))
Now copy it across any amount of Columns. You will note that at each Column the row number increases by 1. In affect it will look like:
=SUM($A$1:$A$2) at Column D
=SUM($A$1:$A$3) at Column E
=SUM($A$1:$A$4) at Column F
=SUM($A$1:$A$5) at Column G
etc
The Syntax for the ADDRESS Function is
ADDRESS(row_num,column_num,abs_num,a1,sheet_text)
The last 3 arguments (abs_num,a1,sheet_text) are all optional. If your range resides on another sheet, it is the sheet_text that you need, eg
=SUM(INDIRECT(ADDRESS(1,1,,,"Sheet 2")&":"&ADDRESS(COLUMN()-2,1)))
Note that the Sheet name is supplied to the first ADDRESS function only
See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets
See also:
Excel Data Tables |
Data Validation |
Excel Date & Time Calculations |
Return The Weekday of Date in Excel |
Debug VBA Code |
Debug, Evaluate/Audit & Fix Excel Formula Errors |
Decreasing Validation Lists |
Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.
Microsoft ® and Microsoft Excel ® are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft.