1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?>
2cdf0e10cSrcweir<helpdocument version="1.0">
3cdf0e10cSrcweir
4*52ac0773SAndrew Rist<!--***********************************************************
5cdf0e10cSrcweir *
6*52ac0773SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
7*52ac0773SAndrew Rist * or more contributor license agreements.  See the NOTICE file
8*52ac0773SAndrew Rist * distributed with this work for additional information
9*52ac0773SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
10*52ac0773SAndrew Rist * to you under the Apache License, Version 2.0 (the
11*52ac0773SAndrew Rist * "License"); you may not use this file except in compliance
12*52ac0773SAndrew Rist * with the License.  You may obtain a copy of the License at
13*52ac0773SAndrew Rist *
14*52ac0773SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
15*52ac0773SAndrew Rist *
16*52ac0773SAndrew Rist * Unless required by applicable law or agreed to in writing,
17*52ac0773SAndrew Rist * software distributed under the License is distributed on an
18*52ac0773SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19*52ac0773SAndrew Rist * KIND, either express or implied.  See the License for the
20*52ac0773SAndrew Rist * specific language governing permissions and limitations
21*52ac0773SAndrew Rist * under the License.
22*52ac0773SAndrew Rist *
23*52ac0773SAndrew Rist ***********************************************************-->
24*52ac0773SAndrew Rist
25*52ac0773SAndrew Rist
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir<meta>
29cdf0e10cSrcweir      <topic id="textscalc0104060105xml" indexer="include">
30cdf0e10cSrcweir         <title xml-lang="en-US" id="tit">Logical Functions</title>
31cdf0e10cSrcweir         <filename>/text/scalc/01/04060105.xhp</filename>
32cdf0e10cSrcweir      </topic>
33cdf0e10cSrcweir   </meta>
34cdf0e10cSrcweir   <body>
35cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="index" id="bm_id3153484"><bookmark_value>logical functions</bookmark_value>
36cdf0e10cSrcweir      <bookmark_value>Function Wizard; logical</bookmark_value>
37cdf0e10cSrcweir      <bookmark_value>functions; logical functions</bookmark_value>
38cdf0e10cSrcweir</bookmark>
39cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3153484" role="heading" level="1" l10n="U" oldref="1">Logical Functions</paragraph>
40cdf0e10cSrcweir      <paragraph xml-lang="en-US" id="par_id3149312" role="paragraph" l10n="U" oldref="2"><variable id="logischtext">This category contains the <emph>Logical</emph> functions.
41cdf0e10cSrcweir</variable></paragraph>
42cdf0e10cSrcweir      <section id="howtoget">
43cdf0e10cSrcweir         <embed href="text/scalc/00/00000404.xhp#eikalo"/>
44cdf0e10cSrcweir      </section>
45cdf0e10cSrcweir<sort order="asc">
46cdf0e10cSrcweir<section id="Section6">
47cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="index" id="bm_id3147505"><bookmark_value>AND function</bookmark_value>
48cdf0e10cSrcweir</bookmark>
49cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_UND" id="bm_id3145320" localize="false"/>
50cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3147505" role="heading" level="2" l10n="U"
51cdf0e10cSrcweir                    oldref="29">AND</paragraph>
52cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3153959" role="paragraph" l10n="U" oldref="65"><ahelp hid="HID_FUNC_UND">Returns TRUE if all arguments are TRUE.</ahelp> If one of the elements is FALSE, this function returns the FALSE value.</paragraph>
53cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3146100" role="paragraph" l10n="U" oldref="66">The arguments are either logical expressions themselves (TRUE, 1&lt;5, 2+3=7, B8&lt;10) that return logical values, or arrays (A1:C3) containing logical values.</paragraph>
54cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3150538" role="note" l10n="CHG" oldref="67">When a function expects a single value, but you entered a cell range, then the value from the cell range is taken that is in the same column or row as the formula.<comment>UFI: fixed #i18547#</comment></paragraph>
55cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3149128" role="note" l10n="CHG" oldref="68">If the entered range is outside of the current column or row of the formula, the function returns the error value #VALUE!</paragraph>
56cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3150374" role="heading" level="3" l10n="U"
57cdf0e10cSrcweir                    oldref="31">Syntax</paragraph>
58cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3159123" role="code" l10n="U" oldref="32">AND(LogicalValue1; LogicalValue2 ...LogicalValue30)</paragraph>
59cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3150038" role="paragraph" l10n="CHG" oldref="33">
60cdf0e10cSrcweir            <emph>LogicalValue1; LogicalValue2 ...LogicalValue30</emph> are conditions to be checked. All conditions can be either TRUE or FALSE. If a range is entered as a parameter, the function uses the value from the range that is in the current column or row. The result is TRUE if the logical value in all cells within the cell range is TRUE.</paragraph>
61cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3149143" role="heading" level="3" l10n="U"
62cdf0e10cSrcweir                    oldref="34">Example</paragraph>
63cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3153123" role="paragraph" l10n="U" oldref="35">The logical values of entries 12&lt;13; 14&gt;12, and 7&lt;6 are to be checked:</paragraph>
64cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3145632" role="paragraph" l10n="U" oldref="36">
65cdf0e10cSrcweir            <item type="input">=AND(12&lt;13;14&gt;12;7&lt;6)</item> returns FALSE.</paragraph>
66cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3149946" role="paragraph" l10n="U" oldref="60">
67cdf0e10cSrcweir            <item type="input">=AND (FALSE;TRUE)</item> returns FALSE.</paragraph>
68cdf0e10cSrcweir      </section>
69cdf0e10cSrcweir      <section id="Section5">
70cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="index" id="bm_id3149015"><bookmark_value>FALSE function</bookmark_value>
71cdf0e10cSrcweir</bookmark>
72cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_FALSCH" id="bm_id3154678" localize="false"/>
73cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3149015" role="heading" level="2" l10n="U" oldref="3">FALSE</paragraph>
74cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3149890" role="paragraph" l10n="U" oldref="4"><ahelp hid="HID_FUNC_FALSCH">Returns the logical value FALSE.</ahelp> The FALSE() function does not require any arguments, and always returns the logical value FALSE.</paragraph>
75cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3146939" role="heading" level="3" l10n="U" oldref="5">Syntax</paragraph>
76cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3150030" role="code" l10n="U" oldref="6">FALSE()</paragraph>
77cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3150697" role="heading" level="3" l10n="U" oldref="7">Example</paragraph>
78cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3154842" role="paragraph" l10n="CHG" oldref="8">
79cdf0e10cSrcweir            <item type="input">=FALSE()</item> returns FALSE</paragraph>
80cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3147468" role="paragraph" l10n="CHG" oldref="9">
81cdf0e10cSrcweir            <item type="input">=NOT(FALSE())</item> returns TRUE</paragraph>
82cdf0e10cSrcweir      </section>
83cdf0e10cSrcweir      <section id="Section4">
84cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="index" id="bm_id3150141"><bookmark_value>IF function</bookmark_value>
85cdf0e10cSrcweir</bookmark>
86cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_WENN" id="bm_id3152789" localize="false"/>
87cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3150141" role="heading" level="2" l10n="U"
88cdf0e10cSrcweir                    oldref="48">IF</paragraph>
89cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3148740" role="paragraph" l10n="U" oldref="49"><ahelp hid="HID_FUNC_WENN">Specifies a logical test to be performed.</ahelp></paragraph>
90cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3153325" role="heading" level="3" l10n="U"
91cdf0e10cSrcweir                    oldref="50">Syntax</paragraph>
92cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3154558" role="code" l10n="CHG" oldref="51">IF(Test; ThenValue; OtherwiseValue)</paragraph>
93cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3149727" role="paragraph" l10n="U" oldref="52">
94cdf0e10cSrcweir            <emph>Test</emph> is any value or expression that can be TRUE or FALSE.</paragraph>
95cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3155828" role="paragraph" l10n="U" oldref="53">
96cdf0e10cSrcweir            <emph>ThenValue</emph> (optional) is the value that is returned if the logical test is TRUE.</paragraph>
97cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3154811" role="paragraph" l10n="U" oldref="54">
98cdf0e10cSrcweir            <emph>OtherwiseValue</emph> (optional) is the value that is returned if the logical test is FALSE.</paragraph>
99cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_idN107FA" role="paragraph" l10n="NEW">
100cdf0e10cSrcweir            <embedvar href="text/scalc/00/00000004.xhp#optional"/>
101cdf0e10cSrcweir         </paragraph>
102cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3149507" role="heading" level="3" l10n="U"
103cdf0e10cSrcweir                    oldref="55">Examples</paragraph>
104cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3150867" role="paragraph" l10n="U" oldref="57">
105cdf0e10cSrcweir            <item type="input">=IF(A1&gt;5;100;"too small")</item> If the value in A1 is higher than 5, the value 100 is entered in the current cell; otherwise, the text “too small” (without quotes) is entered.</paragraph>
106cdf0e10cSrcweir      </section>
107cdf0e10cSrcweir      <section id="Section3">
108cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="index" id="bm_id3155954"><bookmark_value>NOT function</bookmark_value>
109cdf0e10cSrcweir</bookmark>
110cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_NICHT" id="bm_id3145168" localize="false"/>
111cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3155954" role="heading" level="2" l10n="U"
112cdf0e10cSrcweir                    oldref="12">NOT</paragraph>
113cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3153570" role="paragraph" l10n="CHG" oldref="13"><ahelp hid="HID_FUNC_NICHT">Complements (inverts) a logical value.</ahelp></paragraph>
114cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3147372" role="heading" level="3" l10n="U"
115cdf0e10cSrcweir                    oldref="14">Syntax</paragraph>
116cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3157996" role="code" l10n="U" oldref="15">NOT(LogicalValue)</paragraph>
117cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3148766" role="paragraph" l10n="CHG" oldref="16">
118cdf0e10cSrcweir            <emph>LogicalValue</emph> is any value to be complemented.</paragraph>
119cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3149884" role="heading" level="3" l10n="U"
120cdf0e10cSrcweir                    oldref="17">Example</paragraph>
121cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3150132" role="paragraph" l10n="CHG" oldref="18">
122cdf0e10cSrcweir            <item type="input">=NOT(A)</item>. If A=TRUE then NOT(A) will evaluate FALSE.</paragraph>
123cdf0e10cSrcweir      </section>
124cdf0e10cSrcweir      <section id="Section2">
125cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="index" id="bm_id3148394"><bookmark_value>OR function</bookmark_value>
126cdf0e10cSrcweir</bookmark>
127cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_ODER" id="bm_id3155620" localize="false"/>
128cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3148394" role="heading" level="2" l10n="U"
129cdf0e10cSrcweir                    oldref="20">OR</paragraph>
130cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3156060" role="paragraph" l10n="U" oldref="61"><ahelp hid="HID_FUNC_ODER">Returns TRUE if at least one argument is TRUE.</ahelp> This function returns the value FALSE, if all the arguments have the logical value FALSE.</paragraph>
131cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3148771" role="paragraph" l10n="U" oldref="62">The arguments are either logical expressions themselves (TRUE, 1&lt;5, 2+3=7, B8&lt;10) that return logical values, or arrays (A1:C3) containing logical values.</paragraph>
132cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3153546" role="note" l10n="CHG" oldref="63">When a function expects a single value, but you entered a cell range, then the value from the cell range is taken that is in the same column or row as the formula.</paragraph>
133cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3149027" role="note" l10n="CHG" oldref="64">If the entered range is outside of the current column or row of the formula, the function returns the error value #VALUE!</paragraph>
134cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3155517" role="heading" level="3" l10n="U"
135cdf0e10cSrcweir                    oldref="22">Syntax</paragraph>
136cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3150468" role="code" l10n="U" oldref="23">OR(LogicalValue1; LogicalValue2 ...LogicalValue30)</paragraph>
137cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3155819" role="paragraph" l10n="CHG" oldref="24">
138cdf0e10cSrcweir            <emph>LogicalValue1; LogicalValue2 ...LogicalValue30</emph> are conditions to be checked. All conditions can be either TRUE or FALSE. If a range is entered as a parameter, the function uses the value from the range that is in the current column or row.<comment>UFI: first try to fix bugtraq 4905779</comment></paragraph>
139cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3153228" role="heading" level="3" l10n="U"
140cdf0e10cSrcweir                    oldref="25">Example</paragraph>
141cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3154870" role="paragraph" l10n="U" oldref="26">The logical values of entries 12&lt;11; 13&gt;22, and 45=45 are to be checked.</paragraph>
142cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3155371" role="paragraph" l10n="U" oldref="27">
143cdf0e10cSrcweir            <item type="input">=OR(12&lt;11;13&gt;22;45=45)</item> returns TRUE.</paragraph>
144cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3158412" role="paragraph" l10n="U" oldref="59">
145cdf0e10cSrcweir            <item type="input">=OR(FALSE;TRUE)</item> returns TRUE.</paragraph>
146cdf0e10cSrcweir      </section>
147cdf0e10cSrcweir      <section id="Section1">
148cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="index" id="bm_id3156256"><bookmark_value>TRUE function</bookmark_value>
149cdf0e10cSrcweir</bookmark>
150cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_WAHR" id="bm_id3148426" localize="false"/>
151cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3156256" role="heading" level="2" l10n="U"
152cdf0e10cSrcweir                    oldref="38">TRUE</paragraph>
153cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3155985" role="paragraph" l10n="U" oldref="39"><ahelp hid="HID_FUNC_WAHR">The logical value is set to TRUE.</ahelp> The TRUE() function does not require any arguments, and always returns the logical value TRUE.</paragraph>
154cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3153717" role="heading" level="3" l10n="U"
155cdf0e10cSrcweir                    oldref="40">Syntax</paragraph>
156cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3152590" role="code" l10n="U" oldref="41">TRUE()</paragraph>
157cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="hd_id3147175" role="heading" level="3" l10n="U"
158cdf0e10cSrcweir                    oldref="42">Example</paragraph>
159cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3146148" role="paragraph" l10n="U" oldref="43">If A=TRUE and B=FALSE the following examples appear:</paragraph>
160cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3083285" role="paragraph" l10n="U" oldref="44">
161cdf0e10cSrcweir            <item type="input">=AND(A;B)</item> returns FALSE</paragraph>
162cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3083444" role="paragraph" l10n="U" oldref="45">
163cdf0e10cSrcweir            <item type="input">=OR(A;B)</item> returns TRUE</paragraph>
164cdf0e10cSrcweir         <paragraph xml-lang="en-US" id="par_id3154314" role="paragraph" l10n="U" oldref="46">
165cdf0e10cSrcweir            <item type="input">=NOT(AND(A;B))</item> returns TRUE</paragraph>
166cdf0e10cSrcweir      </section>
167cdf0e10cSrcweir</sort>
168cdf0e10cSrcweir<section id="relatedtopics">
169cdf0e10cSrcweir         <embed href="text/scalc/01/04060100.xhp#drking"/>
170cdf0e10cSrcweir      </section>
171cdf0e10cSrcweir   </body>
172cdf0e10cSrcweir</helpdocument>