summaryrefslogtreecommitdiff
path: root/source/text/scalc/01/func_error_type.xhp
blob: 91bbfd9fbdb487eaae41bee6096ffd55dcd5dede (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
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
<!--
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
-->

<meta>
  <topic id="textscalc01func_error_typexml">
    <title id="tit" xml-lang="en-US">ERROR.TYPE function</title>
    <filename>text/scalc/01/func_error_type.xhp</filename>
  </topic>
</meta>

<body>

<section id="error_type_function">
<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_ERROR_TYPE_ODF" id="bm_id346023460234602" localize="false"/>
<bookmark xml-lang="en-US" branch="index" id="bm_id346793467934679">
  <bookmark_value>ERROR.TYPE function</bookmark_value>
  <bookmark_value>index of the Error type</bookmark_value>
</bookmark>

<paragraph id="hd_id348223482234822" role="heading" level="2" xml-lang="en-US"><variable id="error_type_head"><link href="text/scalc/01/func_error_type.xhp">ERROR.TYPE</link></variable> function</paragraph>
<paragraph id="par_id350283502835028" role="paragraph" xml-lang="en-US"><ahelp hid="."><variable id="error_type_des">Returns a number representing a specific Error type, or the error value #N/A, if there is no error. </variable></ahelp></paragraph>
</section>

<paragraph id="hd_id351323513235132" role="heading" level="3" xml-lang="en-US">Syntax</paragraph>
<paragraph id="par_id1861223540440" role="code" xml-lang="en-US">ERROR.TYPE(Error_value)</paragraph>
<paragraph id="par_id217737315" role="paragraph" xml-lang="en-US"><emph>Error_value</emph> – required argument. The error value or a reference to a cell, whose value needs to be processed.</paragraph>

<table id="func_error_type_des_table">
  <tablerow>
    <tablecell>
      <paragraph id="par_id15254419018421" role="tablehead" xml-lang="en-US">Error value</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id134093102310948" role="tablehead" xml-lang="en-US">Returns</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id121020152053105891" role="tablecontent" xml-lang="en-US">Err:511</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id121020152052446273" role="tablecontent" localize="false" xml-lang="en-US">1</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id121020152053148760" role="tablecontent" xml-lang="en-US">#DIV/0!</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id121020152052481542" role="tablecontent" localize="false" xml-lang="en-US">2</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id121020152053296785" role="tablecontent" xml-lang="en-US">#VALUE!</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id121020152052517316" role="tablecontent" localize="false" xml-lang="en-US">3</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id121020152053329868" role="tablecontent" xml-lang="en-US">#REF!</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id121020152052546364" role="tablecontent" localize="false" xml-lang="en-US">4</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id121020152053353976" role="tablecontent" xml-lang="en-US">#NAME?</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id121020152052574920" role="tablecontent" localize="false" xml-lang="en-US">5</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id121020152053408216" role="tablecontent" xml-lang="en-US">#NUM!</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id121020152052596412" role="tablecontent" localize="false" xml-lang="en-US">6</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id121020152054007072" role="tablecontent" xml-lang="en-US">#N/A</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id121020152053027085" role="tablecontent" localize="false" xml-lang="en-US">7</paragraph>
    </tablecell>
  </tablerow>
  <tablerow>
    <tablecell>
      <paragraph id="par_id121020152054075191" role="tablecontent" xml-lang="en-US">Anything else</paragraph>
    </tablecell>
    <tablecell>
      <paragraph id="par_id121020152054075192" role="tablecontent" xml-lang="en-US">#N/A</paragraph>
    </tablecell>
  </tablerow>
</table>
<embed href="text/scalc/01/ODFF.xhp#odff"/>

<paragraph id="hd_id352113521135211" role="heading" level="3" xml-lang="en-US">Examples</paragraph>
<paragraph id="hd_id182972884627444" role="heading" level="4" xml-lang="en-US">Simple usage</paragraph>
<paragraph id="par_id15812966716957" role="paragraph" xml-lang="en-US"><item type="input">=ERROR.TYPE(#N/A)</item></paragraph>
<paragraph id="par_id280533214928308" role="paragraph" xml-lang="en-US">Returns 7, because 7 is the index number of the error value #N/A.</paragraph>
<paragraph id="par_id1047088636291" role="paragraph" xml-lang="en-US"><item type="input">=ERROR.TYPE(A3)</item></paragraph>
<paragraph id="par_id24308515918391" role="paragraph" xml-lang="en-US">If A3 contains an expression equivalent to the division by zero, the function returns 2, because 2 is the index number of the error value #DIV/0!</paragraph>
<paragraph id="hd_id9842206115046" role="heading" level="4" xml-lang="en-US">More advanced way</paragraph>
<paragraph id="par_id90121141327448" role="paragraph" xml-lang="en-US">If in division A1 by A2, A2 can turn to zero, you can handle the situation as follows:</paragraph>
<paragraph id="par_id16083887218317" role="paragraph" xml-lang="en-US"><item type="input">=IF(ISERROR(A1/A2);IF(ERROR.TYPE(A1/A2)=2;"the denominator can't be equal to zero");A1/A2)</item></paragraph>
<paragraph id="par_id12475201719494" role="paragraph" xml-lang="en-US">The ISERROR function returns TRUE or FALSE depending on whether there is an error or not. If the error takes place, the function IF addresses to the second argument, if there is no error, it returns the result of the division. The second argument checks the index number representing the specific Error type, and if it is equal to 2, it returns the specified text "the denominator can't be zero" or 0 otherwise. Thus, clear text would signify the division by zero, the result of the division would appear when the division is successful, or if there is, for example, an error of another type, zero would be returned.</paragraph>
<paragraph id="par_id26251175451270" role="warning" xml-lang="en-US">If the ERROR.TYPE function is used as condition of the IF function and the ERROR.TYPE returns #N/A, the IF function returns #N/A as well. Use ISERROR to avoid it as shown in the example above.</paragraph>
<section id="relatedtopics">
<paragraph id="par_id352953529535295" role="paragraph" xml-lang="en-US"><link href="text/scalc/01/04060104.xhp#iserror">ISERROR</link>, <link href="text/scalc/01/04060104.xhp#na">NA</link>, <link href="text/scalc/01/04060104.xhp#Section4">IF</link></paragraph>
<paragraph id="par_id312932390024933" role="paragraph" xml-lang="en-US"><link href="text/scalc/05/02140000.xhp" name="Error codes">Error codes</link></paragraph>
</section>
</body>

</helpdocument>