ADDRESS function
The ADDRESS function in Excel is used to return the cell reference as a text string, given a specified row and column number. This can be useful when you need to dynamically create a cell reference or work with cell addresses in a formula.
Syntax:
=ADDRESS(row_num, column_num, [abs_num], [a1], [sheet])
- row_num: The row number of the cell reference.
- column_num: The column number of the cell reference.
- [abs_num] (optional): This defines the type of reference you want:
1(default): Absolute reference for both row and column (e.g.,$A$1).2: Absolute row, relative column (e.g.,A$1).3: Relative row, absolute column (e.g.,$A1).4: Relative reference for both row and column (e.g.,A1).
- [a1] (optional): This specifies the style of the reference:
TRUE(default): Uses the A1-style reference (e.g.,A1).FALSE: Uses the R1C1-style reference (e.g.,R1C1).
- [sheet] (optional): The name of the worksheet to include in the address. If omitted, it defaults to the current worksheet.
Example 1: Basic Usage
If you want the address of the cell in row 5, column 3 (which corresponds to C5):
=ADDRESS(5, 3)
This will return the text string "C5".
Example 2: Absolute Reference
To return an absolute reference (e.g., $A$1), use:
=ADDRESS(1, 1, 1)
This will return "$A$1".
Example 3: Relative Reference
If you want a relative reference (e.g., A1), use:
=ADDRESS(1, 1, 4)
This will return "A1".
Example 4: Including the Worksheet Name
If you want to include the sheet name in the address, for example, for row 3 and column 2 in the sheet “Sheet2”:
=ADDRESS(3, 2, 1, TRUE, "Sheet2")
This will return "Sheet2!$B$3".
Example 5: R1C1 Reference Style
If you want to use the R1C1 reference style (e.g., R1C1 for row 1, column 1):
=ADDRESS(1, 1, 1, FALSE)
This will return "R1C1".
Benefits:
- Dynamic references: It allows you to create cell references dynamically based on row and column numbers.
- Flexible reference types: You can control whether the reference is absolute or relative.
- Cross-sheet referencing: It can be used to generate cell references that include a specific worksheet name.
The ADDRESS function is especially useful when you need to generate references based on variable values (like row and column numbers) within a formula or when working with more advanced Excel functionalities like dynamic ranges.