## Explanation

In this example the goal to return the full address of a range or named range as text. For example given the range A1:B10, the result should be "A1:B10". The core of the formula below is the ADDRESS function, which is used to return a cell address based on a given row and column. Unfortunately, the formula gets somewhat complicated because we need to use ADDRESS twice: once to get address of the first cell in the range, and once to get the address of the last cell in the range. The two results are joined with concatenation and the range operator (:) and the full range is returned as text. See below for a more elegant solution in Excel 365.

### First cell

To get the first cell in the range, we use this formula:

```
=ADDRESS(ROW(data),COLUMN(data))
```

The ROW function returns the first row number associated with the range, 5 and the COLUMN function returns the first column number associated with the range, 2. With *abs_num* set to 4 (relative), ADDRESS returns the text "B5".

```
=ADDRESS(5,2,4) // returns "B5"
```

*Note: actually, ROW and COLUMN are returning multiple results, but in Legacy Excel, implicit intersection causes just the first result to used, which works well in the formula. In Excel 365 however, all values are returned and we need to take an extra step to get only the first value. See below.*

### Last cell

To get the last cell in the range, we use this formula:

```
=ADDRESS(ROW(data)+ROWS(data)-1,COLUMN(data)+COLUMNS(data)-1,4)
```

See this page for a detailed explanation. Essentially, we follow the same idea as above, adding simple math to calculate the last row and last column of the range, which are fed as before into ADDRESS with *abs_num* set to 4. This reduces to the following expression, which returns the text "D10":

```
=ADDRESS(10,4,4) // returns "D10"
```

Both results are concatenated with a colon in between to get a final range address as text:

```
="B5"&":"&"D10"
="B5:D10
```

### Excel 365 fix

In Excel 365, which works with arrays natively, the syntax of this formula needs to be adjusted with the implicit intersection operator (@) like this:

```
=ADDRESS(@ROW(rng),@COLUMN(rng))&":"&ADDRESS(@ROW(rng)+ROWS(rng)-1,@COLUMN(rng)+COLUMNS(rng)-1)
```

In the formula above, we use implicit intersection to stop the ROW and COLUMN function from returning multiple results for the full range. The @ operator causes ROWS and COLUMNS to return just the first result for the array.

### More elegant formula in Excel 365

New array functions in Excel 365 make it possible to solve the problem with a more elegant formula like this:

```
=LET(a,ADDRESS(ROW(rng),COLUMN(rng)),TAKE(a,1,1)&":"&TAKE(a,-1,-1))
```

Here, the LET function is used assign intermediate results to the variable a. Working from the inside out, the ADDRESS function builds an array containing all cell references for all cells in the range or array:

```
ADDRESS(ROW(rng),COLUMN(rng)) // get all addresses
```

This result is assigned to the variable a. Next, the TAKE function is used to get the first and last address from a:

```
TAKE(a,1,1)&":"&TAKE(a,-1,-1) // concatenate first and last
```

The two address are concatenated with a colon in between to get the final result.

### Named range from another cell

To get an address for a named range in another cell, you'll need to use the INDIRECT function. For example, to get the address of a name in A1, you would use:

```
=ADDRESS(ROW(INDIRECT(A1)),COLUMN(INDIRECT(A1)))&":"&ADDRESS(ROW(INDIRECT(A1))+ROWS(INDIRECT(A1))-1,COLUMN(INDIRECT(A1))+COLUMNS(INDIRECT(A1))-1)
```

Set abs_num to 4 inside ADDRESS to get a relative address.

** Actually, in all cases where we use ROW and COLUMN with a multi-cell named range, we'll get back an array of numbers instead of a single value. However, since we aren't using an array formula, processing is limited to the first item in these arrays.*