1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?>
28e9b354dSmseidel
352ac0773SAndrew Rist<!--***********************************************************
48e9b354dSmseidel *
552ac0773SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
652ac0773SAndrew Rist * or more contributor license agreements.  See the NOTICE file
752ac0773SAndrew Rist * distributed with this work for additional information
852ac0773SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
952ac0773SAndrew Rist * to you under the Apache License, Version 2.0 (the
1052ac0773SAndrew Rist * "License"); you may not use this file except in compliance
1152ac0773SAndrew Rist * with the License.  You may obtain a copy of the License at
128e9b354dSmseidel *
1352ac0773SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
148e9b354dSmseidel *
1552ac0773SAndrew Rist * Unless required by applicable law or agreed to in writing,
1652ac0773SAndrew Rist * software distributed under the License is distributed on an
1752ac0773SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1852ac0773SAndrew Rist * KIND, either express or implied.  See the License for the
1952ac0773SAndrew Rist * specific language governing permissions and limitations
2052ac0773SAndrew Rist * under the License.
218e9b354dSmseidel *
2252ac0773SAndrew Rist ***********************************************************-->
2352ac0773SAndrew Rist
248e9b354dSmseidel<helpdocument version="1.0">
25cdf0e10cSrcweir<meta>
268e9b354dSmseidel<topic id="textscalc0104060105xml" indexer="include">
278e9b354dSmseidel<title xml-lang="en-US" id="tit">Logical Functions</title>
288e9b354dSmseidel<filename>/text/scalc/01/04060105.xhp</filename>
298e9b354dSmseidel</topic>
308e9b354dSmseidel</meta>
318e9b354dSmseidel<body>
32*88cae784Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3153484">
33*88cae784Smseidel<bookmark_value>logical functions</bookmark_value>
348e9b354dSmseidel<bookmark_value>Function Wizard; logical</bookmark_value>
358e9b354dSmseidel<bookmark_value>functions; logical functions</bookmark_value>
36cdf0e10cSrcweir</bookmark>
37cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3153484" role="heading" level="1" l10n="U" oldref="1">Logical Functions</paragraph>
388e9b354dSmseidel<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.
39cdf0e10cSrcweir</variable></paragraph>
408e9b354dSmseidel<section id="howtoget">
418e9b354dSmseidel<embed href="text/scalc/00/00000404.xhp#eikalo"/>
428e9b354dSmseidel</section>
43cdf0e10cSrcweir<sort order="asc">
44cdf0e10cSrcweir<section id="Section6">
45*88cae784Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3147505">
46*88cae784Smseidel<bookmark_value>AND function</bookmark_value>
47cdf0e10cSrcweir</bookmark>
48cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_UND" id="bm_id3145320" localize="false"/>
49cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3147505" role="heading" level="2" l10n="U"
508e9b354dSmseideloldref="29">AND</paragraph>
518e9b354dSmseidel<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>
528e9b354dSmseidel<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>
538e9b354dSmseidel<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>
548e9b354dSmseidel<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>
558e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3150374" role="heading" level="3" l10n="U"
568e9b354dSmseideloldref="31">Syntax</paragraph>
578e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3159123" role="code" l10n="U" oldref="32">AND(LogicalValue1; LogicalValue2 ...LogicalValue30)</paragraph>
588e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3150038" role="paragraph" l10n="CHG" oldref="33">
598e9b354dSmseidel<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>
608e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3149143" role="heading" level="3" l10n="U"
618e9b354dSmseideloldref="34">Example</paragraph>
628e9b354dSmseidel<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>
638e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3145632" role="paragraph" l10n="U" oldref="36">
648e9b354dSmseidel<item type="input">=AND(12&lt;13;14&gt;12;7&lt;6)</item> returns FALSE.</paragraph>
658e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3149946" role="paragraph" l10n="U" oldref="60">
668e9b354dSmseidel<item type="input">=AND (FALSE;TRUE)</item> returns FALSE.</paragraph>
678e9b354dSmseidel</section>
689471d491SKay Schenk<section id="Section1">
69*88cae784Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3156256">
70*88cae784Smseidel<bookmark_value>TRUE function</bookmark_value>
719471d491SKay Schenk</bookmark>
729471d491SKay Schenk<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_WAHR" id="bm_id3148426" localize="false"/>
739471d491SKay Schenk<paragraph xml-lang="en-US" id="hd_id3156256" role="heading" level="2" l10n="U"
748e9b354dSmseideloldref="38">TRUE</paragraph>
758e9b354dSmseidel<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>
768e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3153717" role="heading" level="3" l10n="U"
778e9b354dSmseideloldref="40">Syntax</paragraph>
788e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3152590" role="code" l10n="U" oldref="41">TRUE()</paragraph>
798e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3147175" role="heading" level="3" l10n="U"
808e9b354dSmseideloldref="42">Example</paragraph>
818e9b354dSmseidel<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>
828e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3083285" role="paragraph" l10n="U" oldref="44">
838e9b354dSmseidel<item type="input">=AND(A;B)</item> returns FALSE</paragraph>
848e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3083444" role="paragraph" l10n="U" oldref="45">
858e9b354dSmseidel<item type="input">=OR(A;B)</item> returns TRUE</paragraph>
868e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3154314" role="paragraph" l10n="U" oldref="46">
878e9b354dSmseidel<item type="input">=NOT(AND(A;B))</item> returns TRUE</paragraph>
881aeb69bdSKay Schenk</section>
891aeb69bdSKay Schenk<section id="Section5">
90*88cae784Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3149015">
91*88cae784Smseidel<bookmark_value>FALSE function</bookmark_value>
92cdf0e10cSrcweir</bookmark>
93cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_FALSCH" id="bm_id3154678" localize="false"/>
94cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3149015" role="heading" level="2" l10n="U" oldref="3">FALSE</paragraph>
958e9b354dSmseidel<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>
968e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3146939" role="heading" level="3" l10n="U" oldref="5">Syntax</paragraph>
978e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3150030" role="code" l10n="U" oldref="6">FALSE()</paragraph>
988e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3150697" role="heading" level="3" l10n="U" oldref="7">Example</paragraph>
998e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3154842" role="paragraph" l10n="CHG" oldref="8">
1008e9b354dSmseidel<item type="input">=FALSE()</item> returns FALSE</paragraph>
1018e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3147468" role="paragraph" l10n="CHG" oldref="9">
1028e9b354dSmseidel<item type="input">=NOT(FALSE())</item> returns TRUE</paragraph>
1038e9b354dSmseidel</section>
1041aeb69bdSKay Schenk<section id="Section4">
105*88cae784Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3150141">
106*88cae784Smseidel<bookmark_value>IF function</bookmark_value>
107cdf0e10cSrcweir</bookmark>
108cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_WENN" id="bm_id3152789" localize="false"/>
109cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3150141" role="heading" level="2" l10n="U"
1108e9b354dSmseideloldref="48">IF</paragraph>
1118e9b354dSmseidel<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>
1128e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3153325" role="heading" level="3" l10n="U"
1138e9b354dSmseideloldref="50">Syntax</paragraph>
1148e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3154558" role="code" l10n="CHG" oldref="51">IF(Test; ThenValue; OtherwiseValue)</paragraph>
1158e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3149727" role="paragraph" l10n="U" oldref="52">
1168e9b354dSmseidel<emph>Test</emph> is any value or expression that can be TRUE or FALSE.</paragraph>
1178e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3155828" role="paragraph" l10n="U" oldref="53">
1188e9b354dSmseidel<emph>ThenValue</emph> (optional) is the value that is returned if the logical test is TRUE.</paragraph>
1198e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3154811" role="paragraph" l10n="U" oldref="54">
1208e9b354dSmseidel<emph>OtherwiseValue</emph> (optional) is the value that is returned if the logical test is FALSE.</paragraph>
1218e9b354dSmseidel<paragraph xml-lang="en-US" id="par_idN107FA" role="paragraph" l10n="NEW">
1228e9b354dSmseidel<embedvar href="text/scalc/00/00000004.xhp#optional"/>
1238e9b354dSmseidel</paragraph>
1248e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3149507" role="heading" level="3" l10n="U"
1258e9b354dSmseideloldref="55">Examples</paragraph>
1268e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3150867" role="paragraph" l10n="U" oldref="57">
1278e9b354dSmseidel<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>
1288e9b354dSmseidel</section>
1291aeb69bdSKay Schenk<section id="Section3">
130*88cae784Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3155954">
131*88cae784Smseidel<bookmark_value>NOT function</bookmark_value>
132cdf0e10cSrcweir</bookmark>
133cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_NICHT" id="bm_id3145168" localize="false"/>
134cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3155954" role="heading" level="2" l10n="U"
1358e9b354dSmseideloldref="12">NOT</paragraph>
1368e9b354dSmseidel<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>
1378e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3147372" role="heading" level="3" l10n="U"
1388e9b354dSmseideloldref="14">Syntax</paragraph>
1398e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3157996" role="code" l10n="U" oldref="15">NOT(LogicalValue)</paragraph>
1408e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3148766" role="paragraph" l10n="CHG" oldref="16">
1418e9b354dSmseidel<emph>LogicalValue</emph> is any value to be complemented.</paragraph>
1428e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3149884" role="heading" level="3" l10n="U"
1438e9b354dSmseideloldref="17">Example</paragraph>
1448e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3150132" role="paragraph" l10n="CHG" oldref="18">
1458e9b354dSmseidel<item type="input">=NOT(A)</item>. If A=TRUE then NOT(A) will evaluate FALSE.</paragraph>
1468e9b354dSmseidel</section>
1479471d491SKay Schenk<section id="Section2">
148*88cae784Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3148394">
149*88cae784Smseidel<bookmark_value>OR function</bookmark_value>
150cdf0e10cSrcweir</bookmark>
151cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_ODER" id="bm_id3155620" localize="false"/>
152cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3148394" role="heading" level="2" l10n="U"
1538e9b354dSmseideloldref="20">OR</paragraph>
1548e9b354dSmseidel<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>
1558e9b354dSmseidel<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>
1568e9b354dSmseidel<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>
1578e9b354dSmseidel<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>
1588e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3155517" role="heading" level="3" l10n="U"
1598e9b354dSmseideloldref="22">Syntax</paragraph>
1608e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3150468" role="code" l10n="U" oldref="23">OR(LogicalValue1; LogicalValue2 ...LogicalValue30)</paragraph>
1618e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3155819" role="paragraph" l10n="CHG" oldref="24">
1628e9b354dSmseidel<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>
1638e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3153228" role="heading" level="3" l10n="U"
1648e9b354dSmseideloldref="25">Examples:</paragraph>
1658e9b354dSmseidel<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>
1668e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3155371" role="paragraph" l10n="U" oldref="27">
1678e9b354dSmseidel<item type="input">=OR(12&lt;11;13&gt;22;45=45)</item> returns TRUE.</paragraph>
1688e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3158412" role="paragraph" l10n="U" oldref="59">
1698e9b354dSmseidel<item type="input">=OR(FALSE;TRUE)</item> returns TRUE.</paragraph>
1708e9b354dSmseidel</section>
1719471d491SKay Schenk<section id="Section7">
172*88cae784Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3148394K">
173*88cae784Smseidel<bookmark_value>XOR function</bookmark_value>
1749471d491SKay Schenk</bookmark><comment>kschenk added this entry</comment>
1759471d491SKay Schenk<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_ODER" id="bm_id3155620K" localize="false"/>
1769471d491SKay Schenk<paragraph xml-lang="en-US" id="hd_id3148394K" role="heading" level="2" l10n="U">XOR</paragraph>
1778e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3156060K" role="paragraph" l10n="U"><ahelp hid="HID_FUNC_ODER">Returns the exclusive "or" of arguments.</ahelp></paragraph>
1788e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3148771K" role="paragraph" l10n="U" oldref="62">The arguments are either numbers, logical expressions themselves (TRUE, 1&lt;5, 2+3=7, B8&lt;10) that return logical values, or arrays (A1:C3).</paragraph>
1798e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3149027K" role="note" l10n="CHG">If the entered range is outside of the current column or row of the formula, the function returns the error value #VALUE!</paragraph>
1808e9b354dSmseidel<paragraph xml-lang="en-US" id="hd_id3155517K" role="heading" level="3" l10n="U"
1818e9b354dSmseideloldref="22">Syntax</paragraph>
1828e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3150468K" role="code" l10n="U">XOR(Value1; Value2 ...Value30)</paragraph>
1838e9b354dSmseidel<paragraph xml-lang="en-US" id="par_id3155819K" role="paragraph" l10n="CHG" oldref="24">
184a8d6fec8Smseidel<emph>Value1; Value2 ...Value30</emph> are added modulo 2. TRUE is returned if the result of this addition is 1;
185bd727bc8SMatthias SeidelFALSE is returned if the result of this addition is 0.<comment>UFI: first try to fix bugtraq 4905779</comment></paragraph>
18665523e0fSMatthias Seidel<paragraph xml-lang="en-US" id="hd_id3153228K" role="heading" level="3" l10n="U">Examples:</paragraph>
18765523e0fSMatthias Seidel<paragraph xml-lang="en-US" id="par_id3155371K" role="paragraph" l10n="U">
18865523e0fSMatthias Seidel<item type="input">=XOR(12&lt;11;13&gt;22;10)</item> returns TRUE since this converts to (1+0+10) mod 2 = 0</paragraph>
18965523e0fSMatthias Seidel<paragraph xml-lang="en-US" id="par_id3158412K" role="paragraph" l10n="U">
19065523e0fSMatthias Seidel<item type="input">=XOR(FALSE;TRUE)</item> returns TRUE.</paragraph>
191bd727bc8SMatthias Seidel</section>
192cdf0e10cSrcweir</sort>
193cdf0e10cSrcweir<section id="relatedtopics">
1948e9b354dSmseidel<embed href="text/scalc/01/04060100.xhp#drking"/>
1958e9b354dSmseidel</section>
1968e9b354dSmseidel</body>
197bd727bc8SMatthias Seidel</helpdocument>
198