Documentation/Calc Functions/STYLE

Function name:
STYLE

Category:
Spreadsheet

Summary:
Applies a style to the cell containing the function call and, optionally, applies a second style to that cell after a time delay. STYLE can be helpful when you need to use a formula to dynamically change the formatting applied to a cell.

Syntax:
STYLE(Style[; Time[; Style2]])

Returns:
Returns the value 0, allowing you to add the STYLE function call to other components of a formula without changing the overall value output from the formula.

Arguments:
Style is a string in quotation marks, or a reference to a cell containing that string, that is the name of a cell style to be (initially) assigned to the cell. If the string does not match the name of any defined cell style, the Default cell style is applied instead.

Time is a positive real number, or a reference to a cell containing that number, that is the delay in seconds before applying the Style2 cell style. If this argument is omitted, the default value of 0 is assumed.

Style2 is a string in quotation marks, or a reference to a cell containing that string, that is the name of a cell style to be applied to the cell after the specified delay time has passed. If a delay time is specified and the Style2 argument is omitted, the cell will revert to the Default cell style after the delay time.


 * If Time is a negative value, STYLE resets the value to 0. No error is reported in this circumstance.


 * If Time is set or reset to 0, the initially applied style is not changed and Style2 is never applied.

Additional details:

 * Style switching through the STYLE function occurs when:
 * The function call is first entered in a cell.
 * After selecting, all STYLE function calls are reset.
 * After selecting, the STYLE function call in the selected cell is reset.


 * STYLE is especially useful when used in conjunction with the CURRENT function to apply colors, fonts, or other formatting to a cell depending on its value. For example, consider the formula  . This formula calculates the value of ($A$3*$B$3)/$C$3. If the result of this calculation is greater than 3, then that result is displayed in the formula cell using the Good cell style. Otherwise, the result is displayed in the formula cell using the Bad cell style.


 * There is no direct way in a formula to determine what formatting has been applied to a cell.

Related LibreOffice functions:
CURRENT

T

ODF standard:
None.

Equivalent Excel functions:
None.