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

From Apache OpenOffice Wiki
Jump to: navigation, search
m
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
__NOTOC__
+
{{Documentation/MasterTOC
 +
|bookid=1234'''
 +
|booktitle=<div style="padding: 8px; font-size: 140%; font-weight: bold; background-color: #9BC0F5;">CALC FUNCTIONS</div>
 +
|ShowParttitle=block|parttitle=[[Documentation/How_Tos/Calc:_Spreadsheet_functions|<div style="font-size: 140%;">Spreadsheet Functions]]
 +
|ShowNextPage=block|NextPage=Documentation/How_Tos/Calc:_Statistical_functions
 +
|ShowPrevPage=block|PrevPage=Documentation/How_Tos/Calc:_HYPERLINK_function
 +
|ShowPrevPart=block|PrevPart=Documentation/How_Tos/Calc:_Number_Conversion_functions
 +
|ShowNextPart=block|NextPart=Documentation/How_Tos/Calc:_Statistical_functions
 +
|toccontent= <div style="padding: 4px; font-size: 130%; font-weight: hidden; background-color:#DCE9FC;">FUNCTIONS</div>
 +
 
 +
<div style="font-size: 140%; border-style: outset outset outset none; border-color:#DCE9FC;">Spreadsheet Lookup functions</div>
 +
* [[Documentation/How_Tos/Calc:_ADDRESS_function|<div style="font-size: 120%;">Address]]
 +
* [[Documentation/How_Tos/Calc:_CHOOSE_function|<div style="font-size: 120%;">Choose]]
 +
* [[Documentation/How_Tos/Calc:_HLOOKUP_function|<div style="font-size: 120%;">Hlookup]]
 +
* [[Documentation/How_Tos/Calc:_INDEX_function|<div style="font-size: 120%;">Index]]
 +
* [[Documentation/How_Tos/Calc:_INDIRECT_function|<div style="font-size: 120%;">Indirect]]
 +
* [[Documentation/How_Tos/Calc:_LOOKUP_function|<div style="font-size: 120%;">Lookup]]
 +
* [[Documentation/How_Tos/Calc:_MATCH_function|<div style="font-size: 120%;">Math]]
 +
* [[Documentation/How_Tos/Calc:_OFFSET_function|<div style="font-size: 120%;">Offset]]
 +
* [[Documentation/How_Tos/Calc:_VLOOKUP_function|<div style="font-size: 120%;">Vlookup]]
 +
 
 +
<div style="font-size: 140%; border-style: outset outset outset none; border-color:#DCE9FC;">Spreadsheet Information functions</div>
 +
* [[Documentation/How_Tos/Calc:_AREAS_function|<div style="font-size: 120%;">Areas]]
 +
* [[Documentation/How_Tos/Calc:_COLUMN_function|<div style="font-size: 120%;">Column]]
 +
* [[Documentation/How_Tos/Calc:_COLUMNS_function|<div style="font-size: 120%;">Columns]]
 +
* [[Documentation/How_Tos/Calc:_ERRORTYPE_function|<div style="font-size: 120%;">Errortype]]
 +
* [[Documentation/How_Tos/Calc:_INFO_function|<div style="font-size: 120%;">Info]]
 +
* [[Documentation/How_Tos/Calc:_ROW_function|<div style="font-size: 120%;">Row]]
 +
* [[Documentation/How_Tos/Calc:_ROWS_function|<div style="font-size: 120%;">Rows]]
 +
* [[Documentation/How_Tos/Calc:_SHEET_function|<div style="font-size: 120%;">Sheet]]
 +
* [[Documentation/How_Tos/Calc:_SHEETS_function|<div style="font-size: 120%;">Sheets]]
 +
 
 +
<div style="font-size: 140%; border-style: outset outset outset none; border-color:#DCE9FC;">Other functions</div>
 +
* [[Documentation/How_Tos/Calc:_DDE_function|<div style="font-size: 120%;">Dde]]
 +
* [[Documentation/How_Tos/Calc:_HYPERLINK_function|<div style="font-size: 120%;">Hyperlink]]
 +
* [[Documentation/How_Tos/Calc:_STYLE_function|<div style="font-size: 120%; border-style: double; border-color:#778899;">Style]]
 +
}}__TOC__
  
 
== STYLE  ==
 
== STYLE  ==
Line 46: Line 82:
 
The STYLE function is unique to Calc.
 
The STYLE function is unique to Calc.
  
{{Documentation/SeeAlso|
+
{{SeeAlso|EN|
 
* [[Documentation/How_Tos/Calc: SQRT function|SQRT]]
 
* [[Documentation/How_Tos/Calc: SQRT function|SQRT]]
 
* [[Documentation/How_Tos/Calc: CURRENT function|CURRENT]]
 
* [[Documentation/How_Tos/Calc: CURRENT function|CURRENT]]

Latest revision as of 07:42, 17 July 2018

CALC FUNCTIONS
FUNCTIONS
Spreadsheet Lookup functions
Spreadsheet Information functions
Other functions


STYLE

Applies a style (for example a colour) to a cell.

Syntax:

STYLE(style; timesecs; finalstyle)

STYLE applies the initial style style to its cell for timesecs seconds, and thereafter applies the final style finalstyle. Both styles are given as text.
Styles are listed (and may be created) in the Format - Styles and Formatting menu.
The initial style is applied for timesecs seconds after the cell itself is recalculated. Please note that a manual recalculation (F9 key or Tools - Cell Contents - Recalculate) will not trigger the initial style.
timesecs and finalstyle may together be omitted; style is then applied permanently.
STYLE returns the numeric value 0, so it may be added on to an existing calculation in the cell without changing the result. See the examples below.
Another way to apply styles can be found at Format - Conditional Formating....
There is no direct way to determine (in a formula) what formatting has been applied to a cell.

Example:

In these examples, it is assumed you have created a new style "Red" where the cell has a red background. "Default" is the default style already defined in Calc.


=3 + 5 + STYLE("Red"; 3; "Default")

displays 8 (the result of adding 3 and 5) with a red background for 3 seconds, and in the default style thereafter.

=SQRT(9) + STYLE("Red")

displays 3 (the square root of 9) permanently with a red background.

=A1 + STYLE(IF(A1>3;"Red";"Default"))

displays the numeric contents of cell A1, with a red background if A1 is greater than 3. Here the IF function returns the name of the style for STYLE to use (either "Red" or "Default"), depending on the value of cell A1.

=A1 + STYLE(IF(CURRENT()>3;"Red";"Default"))

also displays the numeric contents of cell A1, with a red background if A1 is greater than 3.

="Some text" & T(STYLE("Red"))

displays the text Some text with a red background. The STYLE function always returns 0, so T(0) will return a zero length string which can be concatenated to an existing string without affecting it.

=IF(STYLE("Red"); ""; yourformula)

where yourformula stands for some formula, displays the result of yourformula with a red background. This method might be useful if you cannot predict whether yourformula will return text or a number (for example with HLOOKUP).

Issues:

The STYLE function is unique to Calc.



See Also
Retrieved from "https://wiki.openoffice.org/w/index.php?title=Documentation/How_Tos/Calc:_STYLE_function&oldid=243392"
Views
Personal tools
Navigation
Tools