xref: /trunk/main/helpcontent2/source/text/scalc/01/func_iferror.xhp (revision 1354dfcdad4129e7cc561fdcfbb4f6c8958f0428)
1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--***********************************************************
4 *
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements.  See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership.  The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License.  You may obtain a copy of the License at
12 *
13 *   http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied.  See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 *
22 ***********************************************************-->
23
24<helpdocument version="1.0">
25<meta>
26<topic id="textscalc01func_iferrorxml" indexer="include" status="PUBLISH">
27<title id="tit" xml-lang="en-US">IFERROR</title>
28<filename>/text/scalc/01/func_iferror.xhp</filename>
29</topic>
30</meta>
31<body>
32<bookmark xml-lang="en-US" branch="index" id="bm_id3170001">
33<bookmark_value>IFERROR function</bookmark_value>
34<bookmark_value>error handling;IFERROR</bookmark_value>
35</bookmark>
36<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_IFERROR" id="bm_id3170002" localize="false"/>
37<paragraph role="heading" id="hd_id3170001" xml-lang="en-US" level="2" l10n="NEW"><variable id="iferror"><link href="text/scalc/01/func_iferror.xhp">IFERROR</link>
38</variable></paragraph>
39<paragraph role="paragraph" id="par_id3170003" xml-lang="en-US" l10n="NEW"><ahelp hid="HID_FUNC_IFERROR">Returns the value if it is not an error value, otherwise it returns the alternative value.</ahelp> Every error value is replaced, including #N/A; ordinary values pass through unchanged.</paragraph>
40<paragraph role="heading" id="hd_id3170004" xml-lang="en-US" level="3" l10n="NEW">Syntax</paragraph>
41<paragraph role="code" id="par_id3170005" xml-lang="en-US" l10n="NEW">IFERROR(Value; Alternative)</paragraph>
42<paragraph role="paragraph" id="par_id3170006" xml-lang="en-US" l10n="NEW"><emph>Value</emph> is the value or reference to be checked for an error value.</paragraph>
43<paragraph role="paragraph" id="par_id3170007" xml-lang="en-US" l10n="NEW"><emph>Alternative</emph> is the value returned when <emph>Value</emph> is an error value. It is evaluated only when <emph>Value</emph> is an error value; an error in <emph>Alternative</emph> itself is returned.</paragraph>
44<paragraph role="heading" id="hd_id3170008" xml-lang="en-US" level="3" l10n="NEW">Remarks</paragraph>
45<paragraph role="paragraph" id="par_id3170009" xml-lang="en-US" l10n="NEW">A reference to an empty cell is not an error value, so <emph>Value</emph> is returned and shows as 0.</paragraph>
46<paragraph role="paragraph" id="par_id3170010" xml-lang="en-US" l10n="NEW">In an array formula, each element of <emph>Value</emph> that is an error value is replaced on its own; if <emph>Alternative</emph> is also a range or array, the matching element of <emph>Alternative</emph> is used.</paragraph>
47<paragraph role="paragraph" id="par_id3170011" xml-lang="en-US" l10n="NEW">To replace only #N/A and keep other error values, use IFNA.</paragraph>
48<paragraph role="heading" id="hd_id3170012" xml-lang="en-US" level="3" l10n="NEW">Example</paragraph>
49<paragraph role="paragraph" id="par_id3170013" xml-lang="en-US" l10n="NEW"><item type="input">=IFERROR(1/0; "fallback")</item> returns <quote>fallback</quote>.</paragraph>
50<paragraph role="paragraph" id="par_id3170014" xml-lang="en-US" l10n="NEW"><item type="input">=IFERROR(SQRT(-1); 10)</item> returns 10, because the square root of a negative number gives the error Err:502.</paragraph>
51<paragraph role="paragraph" id="par_id3170015" xml-lang="en-US" l10n="NEW"><item type="input">=IFERROR(5; 1/0)</item> returns 5; the alternative is not evaluated.</paragraph>
52<embed href="text/shared/00/00000001.xhp#siehe"/>
53<paragraph role="paragraph" id="par_id3170016" xml-lang="en-US" l10n="NEW"><link href="text/scalc/01/func_ifna.xhp" name="IFNA">IFNA</link>, <link href="text/scalc/01/04060104.xhp#iserror" name="ISERROR">ISERROR</link>.</paragraph>
54</body>
55</helpdocument>
56