# Get Address of Cell Range

DsExcel lets you retrieve the cell address or range address in A1 or R1C1 notation (absolute and relative references).

## Content





In DsExcel, the address of cells or their ranges can be retrieved in A1 or R1C1 notation (both absolute and relative references). The read-only [getAddress](/document-solutions/java-excel-api/api/online/com/grapecity/documents/excel/IRange.html#getAddress) method of **IRange** interface can be used to get the range reference in absolute A1 format. However, you can use the **getAddress** method of **IRange** interface to define the reference notation and absolute and relative references. It takes 4 optional parameters which when omitted, return the same value as **getAddress** method.

The below table elaborates how to use DsExcel API members to retrieve the address of cell\[0,0\] in different notations and references.

| **Cell Reference Notation** | **Absolute Reference** | **Relative Reference** |
| --- | --- | --- |
| **A1** |   Address property  _Output: $A$1_   |   GetAddress method (set rowAbsolute and columnAbsolute parameters to False)  _Output: A1_   |
| **R1C1** |   GetAddress method (set referenceStyle parameter to R1C1)  _Output: R1C1_   |   GetAddress method (set referenceStyle parameter to R1C1, rowAbsolute and columnAbsolute parameters to False)  _Output: RC_   |

Refer to the below example code to retrieve the address of a cell in different notations and references.

```Java
// Create a new workbook
Workbook workbook = new Workbook();
IRange mc = workbook.getWorksheets().get("Sheet1").getCells().get(0, 0);
        
// Get absolute address in A1 notation
System.out.println(mc.getAddress()); 
        
// Get row's relative and column's absolute address in A1 notation
System.out.println(mc.getAddress(false, true));
        
// Get absolute address in R1C1 notation
System.out.println(mc.getAddress(true, true, ReferenceStyle.R1C1));
        
// Get relative address in R1C1 notation
System.out.println(mc.getAddress(false, false, ReferenceStyle.R1C1, workbook.getWorksheets().get(0).getCells().get(2, 2)));
```