Documentation/Calc Functions/OFFSET

From The Document Foundation Wiki
Jump to: navigation, search


Im-jabber.svg

Under construction.
For now, see the system Help files.


Function name:

OFFSET

Category:

Spreadsheet

Summary:

Returns the value of a cell offset by a certain number of rows and columns from a given reference point.

Syntax:

OFFSET(Reference; Rows; Columns; Height; Width)

Returns:

Arguments:

Reference is the reference from which the function searches for the new reference.

Rows is the number of rows by which the reference was corrected up (negative value) or down. Use 0 to stay in the same row.

Columns is the number of columns by which the reference was corrected to the left (negative value) or to the right. Use 0 to stay in the same column

Height (optional) is the vertical height for an area that starts at the new reference position.

Width (optional) is the horizontal width for an area that starts at the new reference position.

Arguments Rows and Columns must not lead to zero or negative start row or column.

Arguments Height and Width must not lead to zero or negative count of rows or columns.

In the LibreOffice Calc functions, parameters marked as "optional" can be left out only when no parameter follows. For example, in a function with four parameters, where the last two parameters are marked as "optional", you can leave out parameter 4 or parameters 3 and 4, but you cannot leave out parameter 3 alone.

Additional details:

If the width or height is included, the OFFSET function returns a range and thus must be entered as an array formula. If both the width and height are missing, a cell reference is returned.

Examples:

=OFFSET(A1;2;2) returns the value in cell C3 (A1 moved by two rows and two columns down). If C3 contains the value 100 this function returns the value 100.

=OFFSET(B2:C3;1;1) returns a reference to B2:C3 moved down by 1 row and one column to the right (C3:D4).

=OFFSET(B2:C3;-1;-1) returns a reference to B2:C3 moved up by 1 row and one column to the left (A1:B2).

=OFFSET(B2:C3;0;0;3;4) returns a reference to B2:C3 resized to 3 rows and 4 columns (B2:E4).

=OFFSET(B2:C3;1;0;3;4) returns a reference to B2:C3 moved down by one row resized to 3 rows and 4 columns (B3:E5).

=SUM(OFFSET(A1;2;2;5;6)) determines the total of the area that starts in cell C3 and has a height of 5 rows and a width of 6 columns (area=C3:H7).

Related LibreOffice functions:

ODF standard:

Equivalent Excel functions: