summaryrefslogtreecommitdiffstats
path: root/helpcontent2/source/text/scalc/guide/integer_leading_zero.xhp
blob: 8380d830bd4d4a28ca913cf2812ee0f9357e96fc (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
<?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/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
-->

<meta>
  <topic id="textscalcguideinteger_leading_zeroxml" indexer="include" status="PUBLISH">
    <title id="tit" xml-lang="en-US">Entering a Number with Leading Zeros</title>
    <filename>/text/scalc/guide/integer_leading_zero.xhp</filename>
  </topic>
</meta>

<body>

<bookmark xml-lang="en-US" branch="index" id="bm_id3147560">
  <bookmark_value>zero values; entering leading zeros</bookmark_value>
  <bookmark_value>numbers; with leading zeros</bookmark_value>
  <bookmark_value>leading zeros</bookmark_value>
  <bookmark_value>integers with leading zeros</bookmark_value>
  <bookmark_value>cells; changing text/number formats</bookmark_value>
  <bookmark_value>formats; changing text/number</bookmark_value>
  <bookmark_value>text in cells; changing to numbers</bookmark_value>
  <bookmark_value>converting;text with leading zeros, into numbers</bookmark_value>
</bookmark>
<comment>UFI: inserted "converting;text to numbers"</comment><comment>mw changed "converting;" and deleted "numbers,changing..."</comment>

<paragraph id="hd_id3147560" role="heading" level="1" xml-lang="en-US"><variable id="integer_leading_zero"><link href="text/scalc/guide/integer_leading_zero.xhp" name="Entering a Number with Leading Zeros">Entering a Number with Leading Zeros</link></variable></paragraph>

<section id="inttext">
<paragraph id="par_id3153194" role="paragraph" xml-lang="en-US">There are various ways to enter integers starting with a zero:</paragraph>

<list type="unordered">
  <listitem>
    <paragraph id="par_id3146119" role="listitem" xml-lang="en-US">Enter the number as text. The easiest way is to enter the number starting with an apostrophe (for example, <item type="input">'0987</item>). The apostrophe will not appear in the cell, and the number will be formatted as text. Because it is in text format, however, you cannot calculate with this number.</paragraph>
  </listitem>
  <listitem>
    <paragraph id="par_id3154013" role="listitem" xml-lang="en-US">Format a cell with a number format such as <item type="input">\0000</item>. This format can be assigned in the <emph>Format code</emph> field under the <emph>Format - Cells - Numbers</emph> tab, and defines the cell display as "always put a zero first and then the integer, having at least three places, and filled with zeros at the left if less than three digits".</paragraph>
  </listitem></list>
<paragraph id="par_id3150011" role="paragraph" localize="false" xml-lang="en-US"/>
<paragraph id="par_id3153158" role="paragraph" xml-lang="en-US">If you want to apply a numerical format to a column of numbers in text format (for example, text "000123" becomes number "123"), do the following:</paragraph>

<list type="ordered">
  <listitem>
    <paragraph id="par_id3149377" role="listitem" xml-lang="en-US">Select the column in which the digits are found in text format. Set the cell format in that column as "Number".</paragraph>
  </listitem>
  <listitem>
    <paragraph id="par_id3154944" role="listitem" xml-lang="en-US">Choose <emph>Edit - Find &amp; Replace</emph></paragraph>
  </listitem>
  <listitem>
    <paragraph id="par_id3154510" role="listitem" xml-lang="en-US">In the <emph>Find</emph> box, enter <item type="input">^[0-9]</item></paragraph>
  </listitem>
  <listitem>
    <paragraph id="par_id3155068" role="listitem" xml-lang="en-US">In the <emph>Replace</emph> box, enter <item type="input">&amp;</item></paragraph>
  </listitem>
  <listitem>
    <paragraph id="par_id3149018" role="listitem" xml-lang="en-US">Check <emph>Regular expressions</emph></paragraph>
  </listitem>
  <listitem>
    <paragraph id="par_id3156382" role="listitem" xml-lang="en-US">Check <emph>Current selection only</emph></paragraph>
  </listitem>
  <listitem>
    <paragraph id="par_id3146916" role="listitem" xml-lang="en-US">Click <emph>Replace All</emph></paragraph>
  </listitem>
</list>
</section>

<section id="relatedtopics">
<embed href="text/scalc/guide/text_numbers.xhp#text_numbers"/>
<embed href="text/scalc/guide/format_value.xhp#format_value"/>
</section>
</body>

</helpdocument>