Documentation/Calc Functions/STYLE

From The Document Foundation Wiki
Jump to navigation Jump to search


Function name:

STYLE

Category:

Spreadsheet

Summary:

Applies a style to the cell containing the formula. After a set amount of time, another style can be applied.

Syntax:

STYLE("Style"[; Time[; "Style2"]])

Returns:

Returns a formatted cell with Style for a Time range in seconds changing the formatting to Style2. It always returns the value 0, allowing you to add it to another function without changing the value.

Arguments:

Style is a string or a reference to a cell containing that string which is the name of a cell style assigned to the cell. Style names must be entered in quotation marks.

Time is a positive real number or a reference to the cell containing that number which is the time range in seconds. If this parameter is missing the style will not be changed after a certain amount of time has passed.

Style2 is a string or a reference to a cell containing that string which is the name of a cell style assigned to the cell after a certain amount of time has passed. If this parameter is missing "Default" is assumed.

Additional details:

  • Together with the CURRENT function you can apply a color to a cell depending on the value. For example: =...+STYLE(IF(CURRENT()>3;"red";"green")) applies the style "red" to the cell if the value is greater than 3, otherwise the style "green" is applied. Both cell formats, "red" and "green" have to be defined beforehand.

Examples:

Formula Description Returns
=STYLE("Invisible";60;"Default") The function formats the cell in transparent format for 60 seconds after the document was recalculated or loaded, then the Default format is assigned. Both cell formats have to be defined beforehand. 0
="Text"&T(STYLE("myStyle")) Since STYLE() has a numeric return value of zero, this return value gets appended to a string. This can be avoided using T() as in this case. Text

See also CURRENT() for another example.

Related LibreOffice functions:

CURRENT

ODF standard:

None

Equivalent Excel functions:

None