summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/scalc/guide/cellstyle_conditional.xhp
blob: 15fcbd8d3b61128385fb1ef1b0081e78110f44b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************************
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc..
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************-->
	
<helpdocument version="1.0">
<meta>
<topic id="textscalcguidecellstyle_conditionalxml" indexer="include" status="PUBLISH">
<title id="tit" xml-lang="en-US">Applying Conditional Formatting</title>
<filename>/text/scalc/guide/cellstyle_conditional.xhp</filename>
</topic>
<history>
<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created>
<lastedited date="2004-08-10T11:07:44">converted from old format - fpe</lastedited>
</history>
</meta>
<body>
<bookmark xml-lang="en-US" branch="index" id="bm_id3149263"><bookmark_value>formats; using conditional formats</bookmark_value>
<bookmark_value>conditional formatting; cells</bookmark_value>
<bookmark_value>cells; conditional formatting</bookmark_value>
<bookmark_value>formatting; conditional formatting</bookmark_value>
<bookmark_value>styles;conditional styles</bookmark_value>
<bookmark_value>formats; conditional</bookmark_value>
<bookmark_value>cell formats; conditional</bookmark_value>
</bookmark>
<paragraph role="heading" id="hd_id3149263" xml-lang="en-US" level="1" l10n="U" oldref="24"><variable id="cellstyle_conditional"><link href="text/scalc/guide/cellstyle_conditional.xhp" name="Applying Conditional Formatting">Applying Conditional Formatting</link>
</variable></paragraph>
<paragraph role="paragraph" id="par_id3159156" xml-lang="en-US" l10n="U" oldref="25">Using the menu command <emph>Format - Conditional formatting</emph>, the dialog allows you to define up to three conditions per cell, which must be met in order for the selected cells to have a particular format.</paragraph>
<paragraph role="paragraph" id="par_id3154944" xml-lang="en-US" l10n="U" oldref="26">With conditional formatting, you can, for example, highlight the totals that exceed the average value of all totals. If the totals change, the formatting changes correspondingly, without having to apply other styles manually.</paragraph>
<list type="ordered">
<listitem>
<paragraph role="listitem" id="par_id3154490" xml-lang="en-US" l10n="U" oldref="27">Select the cells to which you want to apply a conditional style.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3155603" xml-lang="en-US" l10n="U" oldref="28">Choose <emph>Format - Conditional Formatting</emph>.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3146969" xml-lang="en-US" l10n="U" oldref="29">Enter the condition(s) into the dialog box. The dialog is described in detail in <link href="text/scalc/01/05120000.xhp" name="$[officename] Help">$[officename] Help</link>, and an example is provided below:</paragraph>
</listitem>
</list>
<bookmark xml-lang="en-US" branch="index" id="bm_id3155766"><bookmark_value>random numbers; generating</bookmark_value>
</bookmark>
<paragraph role="heading" id="hd_id3155766" xml-lang="en-US" level="2" l10n="U" oldref="38">Example of Conditional Formatting: Generate Number Values</paragraph>
<paragraph role="paragraph" id="par_id3150043" xml-lang="en-US" l10n="U" oldref="39">You want to give certain values in your tables particular emphasis. For example, in a table of turnovers, you can show all the values above the average in green and all those below the average in red. This is possible with conditional formatting.</paragraph>
<list type="ordered">
<listitem>
<paragraph role="listitem" id="par_id3155337" xml-lang="en-US" l10n="U" oldref="40">First of all, write a table in which a few different values occur. For your test you can create tables with any random numbers:</paragraph>
<paragraph role="listitem" id="par_id3149565" xml-lang="en-US" l10n="U" oldref="41">In one of the cells enter the formula =RAND(), and you will obtain a random number between 0 and 1. If you want integers of between 0 and 50, enter the formula =INT(RAND()*50).</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3149258" xml-lang="en-US" l10n="U" oldref="42">Copy the formula to create a row of random numbers. Click the bottom right corner of the selected cell, and drag to the right until the desired cell range is selected.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3159236" xml-lang="en-US" l10n="U" oldref="43">In the same way as described above, drag down the corner of the rightmost cell in order to create more rows of random numbers.</paragraph>
</listitem>
</list>
<paragraph role="heading" id="hd_id3149211" xml-lang="en-US" level="2" l10n="U" oldref="44">Example of Conditional Formatting: Define Cell Styles</paragraph>
<paragraph role="paragraph" id="par_id3154659" xml-lang="en-US" l10n="U" oldref="45">The next step is to apply a cell style to all values that represent above-average turnover, and one to those that are below the average. Ensure that the Stylist is visible before proceeding.</paragraph>
<list type="ordered">
<listitem>
<paragraph role="listitem" id="par_id3150883" xml-lang="en-US" l10n="U" oldref="46">Click in a blank cell and select the command <emph>Format Cells</emph> in the context menu.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3155529" xml-lang="en-US" l10n="U" oldref="47">In the <emph>Format Cells</emph> dialog on the <emph>Background</emph> tab, select a background color. Click OK.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3154484" xml-lang="en-US" l10n="U" oldref="48">In the Stylist, click the <emph>New Style from Selection</emph> icon. Enter the name of the new style. For this example, name the style "Above".</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3152889" xml-lang="en-US" l10n="U" oldref="49">To define a second style, click again in a blank cell and proceed as described above. Assign a different background color for the cell and assign a name (for this example, "Below").</paragraph>
</listitem>
</list>
<paragraph role="heading" id="hd_id3148704" xml-lang="en-US" level="2" l10n="U" oldref="60">Example of Conditional Formatting: Calculate Average</paragraph>
<paragraph role="paragraph" id="par_id3148837" xml-lang="en-US" l10n="U" oldref="51">In our particular example, we are calculating the average of the random values. The result is placed in a cell:</paragraph>
<list type="ordered">
<listitem>
<paragraph role="listitem" id="par_id3144768" xml-lang="en-US" l10n="U" oldref="52">Set the cursor in a blank cell, for example, J14, and activate the Function Wizard.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3156016" xml-lang="en-US" l10n="U" oldref="53">Select the AVERAGE function. Use the mouse to select all your random numbers. If you cannot see the entire range, because Function Wizard is obscuring it, you can temporarily zoom out from the dialog using the <link href="text/shared/00/00000001.xhp#eingabesymbol" name="Zoom in/out key">Zoom in/out key</link>.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3153246" xml-lang="en-US" l10n="U" oldref="54">Close Function Wizard with OK.</paragraph>
</listitem>
</list>
<paragraph role="heading" id="hd_id3149898" xml-lang="en-US" level="2" l10n="U" oldref="50">Example of Conditional Formatting: Apply Cell Style</paragraph>
<paragraph role="paragraph" id="par_id3149126" xml-lang="en-US" l10n="U" oldref="55">Now you can apply the conditional formatting to the sheet:</paragraph>
<list type="ordered">
<listitem>
<paragraph role="listitem" id="par_id3150049" xml-lang="en-US" l10n="U" oldref="56">Select all cells with the random numbers.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3153801" xml-lang="en-US" l10n="U" oldref="57">Choose the <emph>Format - Conditional Formatting</emph> command to open the corresponding dialog.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3153013" xml-lang="en-US" l10n="U" oldref="58">Define the condition as follows: If cell value is less than J14, format with cell style "Below", and if cell value is greater than or equal to J14, format with cell style "Above".</paragraph>
</listitem>
</list>
<bookmark xml-lang="en-US" branch="index" id="bm_id3155761"><bookmark_value>cell styles; copying</bookmark_value>
<bookmark_value>copying; cell styles</bookmark_value>
<bookmark_value>tables; copying cell styles</bookmark_value>
</bookmark>
<paragraph role="heading" id="hd_id3155761" xml-lang="en-US" level="2" l10n="U" oldref="61">Example of Conditional Formatting: Copy Cell Style</paragraph>
<paragraph role="paragraph" id="par_id3145320" xml-lang="en-US" l10n="U" oldref="62">To apply the conditional formatting to other cells later:</paragraph>
<list type="ordered">
<listitem>
<paragraph role="listitem" id="par_id3153074" xml-lang="en-US" l10n="U" oldref="63">Click one of the cells that has been assigned conditional formatting.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3149051" xml-lang="en-US" l10n="U" oldref="64">Copy the cell to the clipboard.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3150436" xml-lang="en-US" l10n="U" oldref="65">Select the cells that are to receive this same formatting.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3147298" xml-lang="en-US" l10n="U" oldref="66">Choose <emph>Edit - Paste Special</emph>. The <emph>Paste Special</emph> dialog appears.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3166465" xml-lang="en-US" l10n="U" oldref="67">In the <emph>Selection</emph> area, check only the <emph>Formats</emph> box. All other boxes must be unchecked. Click OK.</paragraph>
</listitem>
</list>
<embed href="text/shared/00/00000004.xhp#related"/>
<embed href="text/scalc/guide/cellstyle_by_formula.xhp#cellstyle_by_formula"/>
<embed href="text/scalc/guide/cellstyle_minusvalue.xhp#cellstyle_minusvalue"/>
<paragraph role="paragraph" id="par_id3159123" xml-lang="en-US" l10n="U" oldref="68"><link href="text/scalc/01/05120000.xhp" name="Format - Conditional formatting">Format - Conditional formatting</link></paragraph>
</body>
</helpdocument>