<html><head><title>Number Format Codes</title><meta name="filename" content="text/common/01/05020301"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
table.Tabelle6{
margin-left:0cm; margin-right:0.005cm;}
span.Tabelle6A{
width:3.316cm;}
span.Tabelle6B{
width:14.676cm;}
table.Tabelle1{
}
span.Tabelle1A{
width:8.999cm;}
table.Tabelle2{
}
span.Tabelle2A{
width:8.999cm;}
table.Tabelle3{
}
span.Tabelle3A{
width:8.999cm;}
td.Tabelle3A1{
}
table.Tabelle4{
}
span.Tabelle4A{
width:8.999cm;}
td.Tabelle4A1{
}
table.Tabelle8{
}
span.Tabelle8A{
width:4.001cm;}
span.Tabelle8B{
width:13.998cm;}
table.Tabelle5{
}
span.Tabelle5A{
width:8.999cm;}
table.Tabelle7{
}
span.Tabelle7A{
width:1.499cm;}
span.Tabelle7B{
width:16.498cm;}
tr.Tabelle71{
}
td.Tabelle7A1{
}
p.P1{
}
p.P2{
}
p.P3{
}
span.T1{
font-weight:bold;}
span.fr1{
}
</style></head><body>
<p class="P1"/>
<p class="Head1">Number Format Codes <help:key-word value="number format code" tag="kw65744_1" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="format code" tag="kw65744_20" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="formats; number format code" tag="kw65744_19" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="conditions; in number formats" tag="kw65744_18" xmlns:help="http://openoffice.org/2000/help"/></p>
<p class="Paragraph">The number format codes (under <help:link Id="65738" xmlns:help="http://openoffice.org/2000/help"><span class="T1">Format - Cell - Number format</span></help:link>can consist of up to three sections separated by a semicolon (;).</p>
<ul class="L1">
<li class="">
<p class="P2">If the code has two sections, the first represents positive values and zero, and the second negative values.</p>
</li>
<li class="">
<p class="P2">If a code has three sections, the first is for positive values, the second for negative values and the third for zero.</p>
</li>
</ul>
<ul class="L2">
<li class="">
<p class="P3">You can also define conditions yourself, in this case you can make the first section of hits dependent on the first condition, the second section dependent on the second condition and the third section will only be run if the first two conditions do not apply. <help:link Id="65744" Eid="einbeispiel" xmlns:help="http://openoffice.org/2000/help">An example</help:link> is found at the end of this page.</p>
</li>
</ul>
<p class="Paragraph">Use the <span class="T1">Standard</span> format to display numbers as integers and fractions as decimals. Use <span class="T1">Scientific</span> to display numbers which exceed the width of the cell.</p>
<p class="Paragraph">To display a certain number of digits (0 or #) to the left and right of the decimal separator (period), insert the separator in the number format. If the format only contains the number sign (#) to the left of the decimal separator, numbers which are less than 1 will begin with a period.</p>
<p class="Paragraph">To create placeholders for numbers, enter the following format codes in a section. If the number has more places to the right of the decimal point than there are placeholders in the format, the number will be rounded according to the number of placeholders. If the number contains more digits left of the decimal point than are placeholders in the format, the actual numbers will be displayed.</p>
<p class="Paragraph"><help:key-word value="fractions; entering" tag="kw65744_17" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="entering; fractions" tag="kw65744_16" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="numbers; entering fractions" tag="kw65744_15" xmlns:help="http://openoffice.org/2000/help"/>The number of question marks indicates how many digits can be included in the numerator and denominator in fractions. Fractions that do not fit the pattern are displayed as floating point numbers.</p>
<p class="Paragraph">To display a comma as a thousand separator or to scale a number with a factor of a thousand, insert a comma in the number format.</p>
<p class="Head2"><help:key-word value="date formats" tag="kw65744_14" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="format; date formats" tag="kw65744_13" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="numbers; date formats" tag="kw65744_12" xmlns:help="http://openoffice.org/2000/help"/>Number Format Codes for Date Formats</p>
<p class="Paragraph">To display days, months and years, insert the following format codes.</p>
<p class="Paragraph">You can adopt the following character strings into the format code if you want to use a certain calendar format. If there is no specific code entered, OpenOffice.org will choose the best-possible calendar to be used.</p>
<p class="Paragraph">All calendar formats are dependent upon the "locale" setting, which you can select in <span class="T1">Tools - Options - Language settings - Languages</span>. An example: The date format code, E, EE, R or RR switches the calendar to the first non-Gregorian calendar that is entered in the current locale setting. If you use a Japanese locale setting this is the Gengou calendar. If you use a Korean locale setting this is the ROC calendar. If no other calendar is entered in the locale setting, the Gregorian calendar is used.</p>
<p class="Head2"><help:key-word value="time formats" tag="kw65744_11" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="formats; time formats" tag="kw65744_10" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="numbers; time formats" tag="kw65744_9" xmlns:help="http://openoffice.org/2000/help"/>Number Format Codes for Time Formats</p>
<p class="Paragraph">To display hours, minutes and seconds insert the following format codes.</p>
<p class="TextInTable">You can also use the decimal point in format code to display fractions of seconds. For example, with the code hh:mm:ss,00 you show the time as 01:02:03,45.</p>
</span></th></tr></table>
<p class="Paragraph"/>
<p class="Paragraph"><help:key-word value="time format; over 24 hours" tag="kw65744_8" xmlns:help="http://openoffice.org/2000/help"/>To show a time with more than 24 hours or more than 60 minutes or seconds, place the outer left part of the code in square brackets. For example, the time code [h]:mm:ss will display more than 24 hours.</p>
<p class="Paragraph">You can calculate with time formats as you would with number formats. This is useful, for example, for subtraction such as: Duration=End time-Start time.</p>
<p class="Paragraph">If a time is entered in the form 02:03,45 or 01:02:03,45 or 25:01:02, the following formats will be assigned if no other time format is set: MM:SS,00 or [HH]:MM:SS,00 or [HH]:MM:SS. For addition and subtraction of times, the value of the cell is displayed in a format according to the result. For example, this follows the pattern =End time - Start time or =(End time - Start time)*24*Hourly rate.</p>
<p class="Paragraph">For the currency format the currency symbol that is available according to the locale setting is specified as the default, if you have selected <span class="T1">Default</span> as the language. The Euro currency can be entered with the following format code:</p>
<p class="Paragraph">Instead of EUR, you also can press the key that generates the euro character on your system. This character may not be available in the character set used in your editing field. However, the character should appear correctly in your document if you use a font that contains the character. <help:switch select="Program" xmlns:help="http://openoffice.org/2000/help"><help:case select="WRITER">In the <span class="T1">Number Format</span> dialog</help:case><help:default>In the <span class="T1">Numbers</span> tab</help:default></help:switch>, you can select the number format Europe for the currency category. There you will find several format codes with the euro symbol.</p>
<p class="Head2">Number Format Codes for Text and Spaces</p>
<p class="Paragraph">To display symbols, either enclose the symbol in double quotation marks or place a backslash (\) before it.</p>
<p class="Paragraph">To create a space the width of a character in the code format, insert an underscore (_) followed by this sign. By entering an underscore and a closing bracket, for example, positive numbers will be displayed flush with negative numbers in brackets.</p>
<p class="Paragraph">To include text in a number format, insert the @ sign in the format. The text entered will be formatted according to the section containing the @ sign. If the format does not contain any text, the text you enter will not be affected by the format.</p>
<p class="Head2">Other Number Format Codes</p>
<p class="Paragraph">To display numbers as percentages, (i.e., the number is multiplied by 100) add the percent sign to the number format.</p>
<p class="Head3">Scientific Format</p>
<p class="Paragraph">To display numbers in scientific format, add the following format codes to a section. If a format contains a 0 or the # sign to the right of an E-, E+, e- or e+, OpenOffice.org will display the number in scientific format and adds an "E" or an "e." The number of zeros or # signs to the right determine the number of exponential places. E- or e- will show a minus sign for negative exponents. E+ or e+ will display a minus sign in negative exponents and a plus sign in positive exponents.</p>
<p class="Head3">Formats with Prefixes and Suffixes</p>
<p class="Paragraph">You can add text extensions to number formats (prefixes and suffixes) and format cells with these codes. For example, define the following format code:</p>
<p class="Paragraph">Using this code, the cell values are displayed as rounded integers, with the text enclosed in quotation marks added as a suffix (the text is displayed without quotation marks in the cell).</p>
<p class="Paragraph">In this example, by entering "1" in a cell the result will be "1 plus." Entering "-5" will produce "5 minus."</p>
<p class="Head3"><a name="einbeispiel"/><help:key-word value="number format code; with conditions" tag="kw65744_3" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="conditions; for number format codes" tag="kw65744_2" xmlns:help="http://openoffice.org/2000/help"/>Conditions in Number Formats</p>
<p class="Paragraph">You can directly include conditions as comparisons to numbers in the format code. Look at the following example:</p>
<p class="Paragraph">In this case a cell is formatted in the number format #.##0,00. If the value in the cell is smaller that or equal to 4 the text color green will be used, red will be used for a value over 7. The text color blue will be used in all other cases.</p>
<p class="Paragraph">The relational operators <, <=, >, >=, = and <> can be used in combination with any number whatsoever.</p>