# Difference between revisions of "Documentation/How Tos/Calc: INDEX function"

From Apache OpenOffice Wiki

< Documentation | How Tos

m (→Example:) |
(→Issues:: rmoved all issues - resolved) |
||

Line 34: | Line 34: | ||

<tt>'''INDEX(B3:C3; 2)'''</tt> | <tt>'''INDEX(B3:C3; 2)'''</tt> | ||

: returns <tt>'''blue'''</tt>. | : returns <tt>'''blue'''</tt>. | ||

− | |||

− | |||

− | |||

− | |||

{{Documentation/SeeAlso| | {{Documentation/SeeAlso| |

## Revision as of 18:58, 1 August 2010

## INDEX

Returns a value from a table, given a row and column number.

### Syntax:

**INDEX(datatable; row; column; areanumber)**

- returns the value at position
,**row**in the range or array**column**.**datatable**

- If
has multiple ranges then**datatable**specifies which is to be used.**areanumber**is optional and defaults to**areanumber**.**1**

- If
has a single column, this syntax may be used:**datatable**

` INDEX(datatable; row)`.

- If
has a single row, this syntax may be used:**datatable**

` INDEX(datatable; column)`.

### Example:

If cells ` B1`,

`,`

**B2**`contain`

**B3**`,`

**5**`and`

**red**`and cells`

**6**`,`

**C1**`,`

**C2**`contain`

**C3**`,`

**TRUE**`and`

**3**`:-`

**blue****INDEX(B1:C3; 1; 1)**

- returns
.**5**

**INDEX(B1:C3; 3; 2)**

- returns
.**blue**

**INDEX(B1:B3; 2)**

- returns
.**red**

**INDEX(B1:C2; 1; 2)**

- returns
.**TRUE**

**INDEX(B3:C3; 2)**

- returns
.**blue**