1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?>
2*b1cdbd2cSJim Jagielski<helpdocument version="1.0">
3*b1cdbd2cSJim Jagielski
4*b1cdbd2cSJim Jagielski<!--***********************************************************
5*b1cdbd2cSJim Jagielski *
6*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
7*b1cdbd2cSJim Jagielski * or more contributor license agreements.  See the NOTICE file
8*b1cdbd2cSJim Jagielski * distributed with this work for additional information
9*b1cdbd2cSJim Jagielski * regarding copyright ownership.  The ASF licenses this file
10*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
11*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
12*b1cdbd2cSJim Jagielski * with the License.  You may obtain a copy of the License at
13*b1cdbd2cSJim Jagielski *
14*b1cdbd2cSJim Jagielski *   http://www.apache.org/licenses/LICENSE-2.0
15*b1cdbd2cSJim Jagielski *
16*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
17*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
18*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19*b1cdbd2cSJim Jagielski * KIND, either express or implied.  See the License for the
20*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
21*b1cdbd2cSJim Jagielski * under the License.
22*b1cdbd2cSJim Jagielski *
23*b1cdbd2cSJim Jagielski ***********************************************************-->
24*b1cdbd2cSJim Jagielski
25*b1cdbd2cSJim Jagielski
26*b1cdbd2cSJim Jagielski
27*b1cdbd2cSJim Jagielski
28*b1cdbd2cSJim Jagielski<meta>
29*b1cdbd2cSJim Jagielski      <topic id="textscalcguidenumbers_textxml" indexer="include" status="PUBLISH">
30*b1cdbd2cSJim Jagielski         <title xml-lang="en-US" id="tit">Converting Text to Numbers</title>
31*b1cdbd2cSJim Jagielski         <filename>/text/scalc/guide/numbers_text.xhp</filename>
32*b1cdbd2cSJim Jagielski      </topic>
33*b1cdbd2cSJim Jagielski   </meta>
34*b1cdbd2cSJim Jagielski   <body>
35*b1cdbd2cSJim Jagielski<bookmark xml-lang="en-US" branch="index" id="bm_id3145068"><bookmark_value>formats; text as numbers</bookmark_value>
36*b1cdbd2cSJim Jagielski      <bookmark_value>time format conversion</bookmark_value>
37*b1cdbd2cSJim Jagielski      <bookmark_value>date formats;conversion</bookmark_value>
38*b1cdbd2cSJim Jagielski      <bookmark_value>converting;text, into numbers</bookmark_value>
39*b1cdbd2cSJim Jagielski</bookmark><comment>mw changed "converting;" and added two index entries</comment>
40*b1cdbd2cSJim Jagielski<paragraph xml-lang="en-US" id="hd_id0908200901265171" role="heading" level="1" l10n="NEW"><variable id="numbers_text"><link href="text/scalc/guide/numbers_text.xhp" name="Converting Text to Numbers">Converting Text to Numbers</link>
41*b1cdbd2cSJim Jagielski</variable></paragraph>
42*b1cdbd2cSJim Jagielski      <section id="text">
43*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="par_id0908200901265127" role="paragraph" l10n="NEW">Calc converts text inside cells to the respective numeric values if an unambiguous conversion is possible. If no conversion is possible, Calc returns a #VALUE! error.</paragraph>
44*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="par_id0908200901265196" role="paragraph" l10n="NEW">Only integer numbers including exponent are converted, and ISO 8601 dates and times in their extended formats with separators. Anything else, like fractional numbers with decimal separators or dates other than ISO 8601, is not converted, as the text string would be locale dependent. Leading and trailing blanks are ignored.</paragraph>
45*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="par_id0908200901265220" role="paragraph" l10n="NEW">The following ISO 8601 formats are converted:</paragraph>
46*b1cdbd2cSJim Jagielski         <list type="unordered">
47*b1cdbd2cSJim Jagielski            <listitem>
48*b1cdbd2cSJim Jagielski               <paragraph xml-lang="en-US" id="par_id0908200901265288" role="paragraph" l10n="NEW">CCYY-MM-DD</paragraph>
49*b1cdbd2cSJim Jagielski            </listitem>
50*b1cdbd2cSJim Jagielski            <listitem>
51*b1cdbd2cSJim Jagielski               <paragraph xml-lang="en-US" id="par_id0908200901265267" role="paragraph" l10n="NEW">CCYY-MM-DDThh:mm</paragraph>
52*b1cdbd2cSJim Jagielski            </listitem>
53*b1cdbd2cSJim Jagielski            <listitem>
54*b1cdbd2cSJim Jagielski               <paragraph xml-lang="en-US" id="par_id0908200901265248" role="paragraph" l10n="NEW">CCYY-MM-DDThh:mm:ss</paragraph>
55*b1cdbd2cSJim Jagielski            </listitem>
56*b1cdbd2cSJim Jagielski            <listitem>
57*b1cdbd2cSJim Jagielski               <paragraph xml-lang="en-US" id="par_id0908200901265374" role="paragraph" l10n="NEW">CCYY-MM-DDThh:mm:ss,s</paragraph>
58*b1cdbd2cSJim Jagielski            </listitem>
59*b1cdbd2cSJim Jagielski            <listitem>
60*b1cdbd2cSJim Jagielski               <paragraph xml-lang="en-US" id="par_id0908200901265327" role="paragraph" l10n="NEW">CCYY-MM-DDThh:mm:ss.s</paragraph>
61*b1cdbd2cSJim Jagielski            </listitem>
62*b1cdbd2cSJim Jagielski            <listitem>
63*b1cdbd2cSJim Jagielski               <paragraph xml-lang="en-US" id="par_id0908200901265399" role="paragraph" l10n="NEW">hh:mm</paragraph>
64*b1cdbd2cSJim Jagielski            </listitem>
65*b1cdbd2cSJim Jagielski            <listitem>
66*b1cdbd2cSJim Jagielski               <paragraph xml-lang="en-US" id="par_id0908200901265347" role="paragraph" l10n="NEW">hh:mm:ss</paragraph>
67*b1cdbd2cSJim Jagielski            </listitem>
68*b1cdbd2cSJim Jagielski            <listitem>
69*b1cdbd2cSJim Jagielski               <paragraph xml-lang="en-US" id="par_id0908200901265349" role="paragraph" l10n="NEW">hh:mm:ss,s</paragraph>
70*b1cdbd2cSJim Jagielski            </listitem>
71*b1cdbd2cSJim Jagielski            <listitem>
72*b1cdbd2cSJim Jagielski               <paragraph xml-lang="en-US" id="par_id0908200901265342" role="paragraph" l10n="NEW">hh:mm:ss.s</paragraph>
73*b1cdbd2cSJim Jagielski            </listitem>
74*b1cdbd2cSJim Jagielski         </list>
75*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="par_id0908200901265491" role="paragraph" l10n="NEW">The century code CC may not be omitted. Instead of the T date and time separator, exactly one space character may be used.</paragraph>
76*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="par_id0908200901265467" role="paragraph" l10n="NEW">If a date is given, it must be a valid Gregorian calendar date. In this case the optional time must be in the range 00:00 to 23:59:59.99999...</paragraph>
77*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="par_id0908200901265420" role="paragraph" l10n="NEW">If only a time string is given, it may have an hours value of more than 24, while minutes and seconds can have a maximum value of 59.</paragraph>
78*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="par_id0908200901265448" role="paragraph" l10n="NEW">The conversion is done for single arguments only, as in =A1+A2, or ="1E2"+1. Cell range arguments are not affected, so SUM(A1:A2) differs from A1+A2 if at least one of the two cells contain a convertible string.</paragraph>
79*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="par_id090820090126540" role="paragraph" l10n="NEW">Strings inside formulas are also converted, such as in ="1999-11-22"+42, which returns the date 42 days after November 22nd, 1999. Calculations involving localized dates as strings inside the formula return an error. For example, the localized date string "11/22/1999" or "22.11.1999" cannot be used for the automatic conversion.</paragraph>
80*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="hd_id1005200903485368" role="heading" level="2" l10n="NEW">Example</paragraph>
81*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="par_id1005200903485359" role="paragraph" l10n="NEW">In A1 enter the text <item type="literal">'1e2</item> (which is converted to the number 100 internally).</paragraph>
82*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="par_id1005200903485341" role="paragraph" l10n="NEW">In A2 enter <item type="literal">=A1+1</item> (which correctly results in 101).</paragraph>
83*b1cdbd2cSJim Jagielski      </section>
84*b1cdbd2cSJim Jagielski      <section id="relatedtopics">
85*b1cdbd2cSJim Jagielski         <embed href="text/scalc/guide/text_numbers.xhp#text_numbers"/>
86*b1cdbd2cSJim Jagielski         <embed href="text/scalc/guide/integer_leading_zero.xhp#integer_leading_zero"/>
87*b1cdbd2cSJim Jagielski         <paragraph xml-lang="en-US" id="par_id0908200901265544" role="paragraph" l10n="NEW"><link href="text/shared/01/05020300.xhp" name="Format - Cells - Numbers">Format - Cells - Numbers</link></paragraph>
88*b1cdbd2cSJim Jagielski         <embed href="text/scalc/guide/format_value.xhp#format_value"/>
89*b1cdbd2cSJim Jagielski      </section>
90*b1cdbd2cSJim Jagielski   </body>
91*b1cdbd2cSJim Jagielski</helpdocument>