Содержимое

# Коды числовых форматов

Number format codes can consist of up to four sections separated by a semicolon (;).

1. In a number format code with two sections, the first section applies to positive values and zero, and the second section applies to negative values.

2. In a number format code with three sections, the first section applies to positive values, the second section to negative values, and the third section to the value zero.

3. You can also assign conditions to the three sections, so that the format is only applied if a condition is met.

4. Fourth section applies if the content is not a value, but some text. Content is represented by an at sign (@).

## Decimal Places and Significant Digits

Use zero (0), the number sign (#) or the question mark (?) as placeholders in your number format code to represent numbers. The # only displays significant digits, while the 0 displays zeroes if there are fewer digits in the number than in the number format. The ? works as the # but adds a space character to keep decimal alignment if there is a hidden non-significant zero.

Use question marks (?), zeroes (0) or number signs (#) to represent the number of digits to include in the numerator and the denominator of a fraction. Fractions that do not fit the pattern that you define are displayed as floating point numbers.

If a number contains more digits to the right of the decimal delimiter than there are placeholders in the format, the number is rounded accordingly. If a number contains more digits to the left of the decimal delimiter than there are placeholders in the format, the entire number is displayed. Use the following list as a guide for using placeholders when you create a number format code:

Заполнители | Описание
--- | ---
# | Does not display extra zeros.
? | Displays space characters instead of extra zeros.
0 (Zero) | Displays extra zeros if the number has less places than zeros in the format.

### Примеры

Числовой формат | Код формата
--- | ---
3456,78 как 3456,8 | ####.#
9,9 как 9,900 | #.000
13 как 13,0 и 1234,567 как 1234,57 | #.0#
5,75 как 5 3/4 и 6,3 как 6 3/10 | # ???/???
,5 как 0,5 | 0.##
,5 как 0,5 (два дополнительных пробела в конце) | 0.???

### Разделитель разрядов

Depending on your language setting, you can use a comma, a period or a blank as a thousands separator. You can also use the separator to reduce the size of the number that is displayed by a multiple of 1000 for each separator. The examples below use comma as thousands separator:

Числовой формат | Код формата
--- | ---
15000 как 15 000 | #,###
16000 как 16 | #,

## Including Text in Number Format Codes

### Text and Numbers

To include text in a number format that is applied to a cell containing numbers, place a double quotation mark (") in front of and behind the text, or a backslash (\) before a single character. For example, enter #.# "meters" to display "3.5 meters" or #.# \m to display "3.5 m". If you use space as thousands separator, you need to insert spaces between quotes in the previous examples: #.#" meters" or #.#\ \m to get the correct result.

### Text and Text

To include text in a number format that is applied to a cell that might contain text, enclose the text by double quotation marks (" "), and then add an at sign (@). For example, enter "Total for "@ to display "Total for December".

### Пробелы

To use a character to define the width of a space in a number format, type an underscore (_) followed by the character. The width of the space varies according to the width of the character that you choose. For example, _M creates a wider space than _i.

To fill free space with a given character, use an asterisk (*) followed by this character. For instance:

*\0

will display integer value (0) preceded by as many as needed backslash characters (\) to fill column width. For accounting representation, you may left align currency symbol with a format similar to:

$_-* 0.--;$-* 0.--;$_-* -

## Цвет

To set the color of a section of a number format code, insert one of the following color names in square brackets [ ]:

CYAN | GREEN
BLACK | BLUE
MAGENTA | RED
WHITE | YELLOW

## Условия

### Conditional Brackets

You can define a number format so that it only applies when the condition that you specify is met. Conditions are enclosed by square brackets [ ].

You can use any combination of numbers and the <, <=, >, >=, = and <> operators.

For example, if you want to apply different colors to different temperature data, enter:

[BLUE][<0]#.0 "°C";[RED][>30]#.0 "°C";[BLACK]#.0 "°C"

All temperatures below zero are blue, temperatures between 0 and 30 °C are black, and temperatures higher than 30 °C are red.

### Positive and Negative Numbers

To define a number format that adds a different text to a number depending on if the number is positive, negative, or equal to zero, use the following format:

"plus" 0;"minus" 0;"null" 0

## Percentages, Scientific Notation and Fraction Representation

### Percentages

To display numbers as percentages, add the percent sign (%) to the number format.

### Научная запись

Scientific notation lets you write very large numbers or very small fractions in a compact form. For example, in scientific notation, 650000 is written as 6.5 x 105, and 0.000065 as 6.5 x 10-5. In LibreOffice, these numbers are written as 6.5E+5 and 6.5E-5, respectively. To create a number format that displays numbers using scientific notation, enter a # or 0, and then one of the following codes E-, E+, e- or e+. If sign is omitted after E or e, it won't appear for positive value of exponent. To get engineering notation, enter 3 digits (0 or #) in the integer part: ###.##E+00 for instance.

### Fraction Representation

To represent a value as a fraction, format consists of two or three parts: integer optional part, numerator and denominator. Integer and numerator are separated by a blank or any quoted text. Numerator and denominator are separated by a slash character. Each part can consist of a combination of #, ? and 0 as placeholders.

Denominator is calculated to get the nearest value of the fraction with respect to the number of placeholders. For example, PI value is represented as 3 16/113 with format:

# ?/???

Denominator value can also be forced to the value replacing placeholders. For example, to get PI value as a multiple of 1/16th (i.e. 50/16), use format:

?/16

## Number Format Codes of Currency Formats

The default currency format for the cells in your spreadsheet is determined by the regional setting of your operating system. If you want, you can apply a custom currency symbol to a cell. For example, enter #,##0.00 € to display 4.50 € (Euros).

You can also specify the locale setting for the currency by entering the locale code for the country after the symbol. For example, [$€-407] represents Euros in Germany. To view the locale code for a country, select the country in the Language list on the Numbers tab of the Format Cells dialog.

В коде формата для денежных единиц используется форма [$xxx-nnn], где xxx - символ валюты, nnn - код страны. Для специальных банковских символов, например, EUR (для евро), код страны не требуется. Формат денежной единицы не зависит от языка, выбранного в поле Язык.

## Форматы даты и времени

Microsoft Excel неверно причисляет 1900 год к числу високосных и при вычислении даты рассматривает несуществующий день 1900-02-29 в качестве допустимого. Поэтому даты до 1900-03-01 в Excel и Calc будут отличатся.

### Форматы даты

To display days, months and years, use the following number format codes.

Не все коды формата дают осмысленные результаты для всех языков.

Формат | Код формата
--- | ---
Месяц как 3. | M
Месяц как 03. | MM
Месяц как Янв-Дек | MMM
Месяц как Январь-Декабрь | MMMM
Первая буква названия месяца | MMMMM
День как 2 | D
День как 02 | DD
Day as Sun-Sat | NN or DDD or AAA
Day as Sunday to Saturday | NNN or DDDD or AAAA
За днем следует запятая, как в «Воскресенье,» | NNNN
Год как 00-99 | YY
Год как 1900-2078 | YYYY
Календарная неделя | WW
Quarterly as Q1 to Q4 | Q
Quarterly as 1st quarter to 4th quarter | QQ
Era, abbreviation. On the Japanese Gengou calendar, single character (possible values are: M, T, S, H) | G
Era, abbreviation | GG
Era, full name | GGG
Number of the year within an era, short format | E
Number of the year within an era, long format | EE or R
Era, full name and year | RR or GGGEE

The above listed formatting codes work with your language version of LibreOffice. However, when you need to switch the locale of LibreOffice to another locale, you need to know the formatting codes used in that other locale.

Например, если программное обеспечение настроено на локаль Английский, но хотите отформатировать год с использованием четырёх цифр, в качестве кода формата вводите YYYY. При переключении на локаль Немецкий необходимо использовать код формата JJJJ. В следующей таблице перечислены только локализованные различия.

Локаль | Год | Месяц | День | Час | День недели | Эра
--- | --- | --- | --- | --- | --- | ---
English - en и все не перечисленные локали | Y | M | D | H | A | G
Немецкий - de | J |  | T |  |  |
Нидерланды - nl | J |  |  | U |  |
Французский - fr | A |  | J |  | O |
Итальянский - it | A |  | G |  | O | X
Португальский - pt | A |  |  |  | O |
Испанский - es | A |  |  |  | O |
Датский - da |  |  |  | T |  |
Норвежский - no, nb, nn |  |  |  | T |  |
Шведский - sv |  |  |  | T |  |
Финский - fi | V | K | P | T |  |

### Entering Dates

To enter a date in a cell, use the Gregorian calendar format. For example, in an English locale, enter 1/2/2002 for Jan 2, 2002.

All date formats are dependent on the locale that is set in LibreOffice - Preferences Tools - Options - Languages and Locales - General. For example, if your locale is set to 'Japanese', then the Gengou calendar is used. The default date format in LibreOffice uses the Gregorian Calendar.

To specify a calendar format that is independent of the locale, add a modifier in front of the date format. For example, to display a date using the Jewish calendar format in a non-Hebrew locale, enter: [~jewish]DD/MM/YYYY.

The specified calendar is exported to Microsoft Excel using extended LCID. Extended LCID can also be used in the format string. It will be converted to a calendar modifier if it is supported. See Extended LCID section below.

Modifier | Календарь
--- | ---
[~buddhist] | Thai Buddhist Calendar
[~gengou] | Japanese Gengou Calendar
[~gregorian] | Gregorian Calendar
[~hanja] or [~hanja_yoil] | Korean Calendar
[~hijri] | Arabic Islamic Calendar
[~jewish] | Jewish Calendar
[~ROC] | Republic Of China Calendar

If you perform a calculation that involves one or more cells using a date format, the result is formatted according to the following mappings:

Initial Format | Result Format
--- | ---
Дата + Дата | Number (Days)
Дата + Число | Дата
Дата + Время | Дата и время
Дата + Дата и время | Число
Время + Время | Время
Time + Number | Время
Время + Дата и время | Дата и время
Дата и время + Дата и время | Время
Дата и время + Число | Дата и время
Number + Number | Число

The Date & Time format displays the date and time that an entry was made to a cell with this format.

In LibreOffice, years are indicated by four digits, so that the difference between 1/1/99 and 1/1/01 is two years. This Year (two digits) setting allows the user to define the years in which two-digit dates are added to 2000. To illustrate, if you specify a date of 1930 or later, the entry "1/1/20" is recognized as 2020-01-01 instead of 1920-01-01.

By default in LibreOffice, a date with the value "0" corresponds to Dec 30, 1899.

### Форматы времени

To display hours, minutes and seconds use the following number format codes:

Формат | Код формата
--- | ---
Часы как 0-23 | H
Часы как 00-23 | HH
Часы от 00 до более 23 | [HH]
Минуты как 0-59 | M
Минуты как 00-59 | MM
Минуты от 00 до более 59 | [MM]
Секунды как 0-59 | S
Секунды как 00-59 | SS
Секунды от 00 до более 59 | [SS]

To display seconds as fractions, add the decimal delimiter to your number format code. For example, enter HH:MM:SS.00 to display the time as "01:02:03.45".

Minute time formats M and MM must be used in combination with hour or second time formats to avoid confusion with month date format.

If a time is entered in the form 02:03.45 or 01:02:03.45 or 25:01:02, the following formats are assigned if no other time format has been specified: MM:SS.00 or [HH]:MM:SS.00 or [HH]:MM:SS

The time can be suffixed with AM/PM to have hours in 0-12 AM/PM format.

## Displaying Numbers Using Native Characters

## NatNum modifiers

To display numbers using native number characters, use a [NatNum1], [NatNum2], ..., [NatNum11] modifier at the beginning of a number format codes.

To spell out numbers in various number, currency and date formats, use a [NatNum12] modifier with the chosen arguments at the beginning of a number format code. See NatNum12 section below.

The [NatNum1] modifier always uses a one to one character mapping to convert numbers to a string that matches the native number format code of the corresponding locale. The other modifiers produce different results if they are used with different locales. A locale can be the language and the territory for which the format code is defined, or a modifier such as [$-yyy] that follows the native number modifier. In this case, yyy is the hexadecimal MS-LCID that is also used in currency format codes. For example, to display a number using Japanese short Kanji characters in an English US locale, use the following number format code:

[NatNum1][$-411]0

In the following list, the Microsoft Excel [DBNumX] modifier that corresponds to LibreOffice [NatNum] modifier is shown. If you want, you can use a [DBNumX] modifier instead of [NatNum] modifier for your locale. Whenever possible, LibreOffice internally maps [DBNumX] modifiers to [NatNumN] modifiers.

Отображение дат с помощью модификаторов [NatNum] может иметь иной результат, чем отображение других типов чисел. Такие результаты получаются при использовании обозначения "CAL: ". Например, "CAL: 1/4/4" указывает, что год отображается с помощью модификатора [NatNum1], тогда как день и месяц - с помощью модификатора [NatNum4]. Если не указано "CAL", эти форматы дат для данного модификатора не поддерживаются.

[NatNum0]

Try to convert any native number string to ASCII Arabic digits. If already ASCII, it remains ASCII.

[NatNum1]

Транслитерации | Native Number Characters | DBNumX | Формат даты
--- | --- | --- | ---
Китайский | Китайские строчные символы |  | CAL: 1/7/7 [DBNum1]
Японский | short Kanji characters | [DBNum1] | CAL: 1/4/4 [DBNum1]
Корейский | Корейские строчные символы | [DBNum1] | CAL: 1/7/7 [DBNum1]
Иврит | Hebrew characters |  |
Арабский | Arabic-Indic characters |  |
Тайский | Thai characters |  |
Хинди | Indic-Devanagari characters |  |
Ория | Ория символы |  |
Маратхи | Indic-Devanagari characters |  |
Бенгальский | Bengali characters |  |
Панджаби | Punjabi (Gurmukhi) characters |  |
Гуджарати | Gujarati characters |  |
Тамильский | Tamil characters |  |
Телугу | Telugu characters |  |
Каннада | Kannada characters |  |
Малаялам | Malayalam characters |  |
Лаосский | Lao characters |  |
Тибетский | Tibetan characters |  |
Бирманский | Burmese (Myanmar) characters |  |
Кхмерский | Кхмерские (Камбоджийские) символы |  |
Монгольский | Mongolian characters |  |
Непальский | Indic-Devanagari characters |  |
Дзонг-кэ | Tibetan characters |  |
Фарси | East Arabic-Indic characters |  |
Церковнославянский | Cyrillic characters |  |

[NatNum2]

Транслитерации | Native Number Characters | DBNumX | Формат даты
--- | --- | --- | ---
Китайский | Китайские прописные символы |  | CAL 2/8/8 [DBNum2]
Японский | traditional Kanji characters |  | CAL 2/5/5 [DBNum2]
Корейский | Корейские прописные символы | [DBNum2] | CAL 2/8/8 [DBNum2]
Иврит | Hebrew numbering |  |

[NatNum3]

Транслитерации | Native Number Characters | DBNumX | Формат даты
--- | --- | --- | ---
Китайский | fullwidth Arabic digits |  | CAL: 3/3/3 [DBNum3]
Японский | fullwidth Arabic digits |  | CAL: 3/3/3 [DBNum3]
Корейский | fullwidth Arabic digits | [DBNum3] | CAL: 3/3/3 [DBNum3]

[NatNum4]

Транслитерации | Native Number Characters | DBNumX | Формат даты
--- | --- | --- | ---
Китайский | lower case text | [DBNum1] |
Японский | modern long Kanji text | [DBNum2] |
Корейский | formal lower case text |  |

[NatNum5]

Транслитерации | Native Number Characters | DBNumX | Формат даты
--- | --- | --- | ---
Китайский | Китайский прописной текст | [DBNum2] |
Японский | traditional long Kanji text | [DBNum3] |
Корейский | formal upper case text |  |

[NatNum6]

Транслитерации | Native Number Characters | DBNumX | Формат даты
--- | --- | --- | ---
Китайский | fullwidth text | [DBNum3] |
Японский | fullwidth text |  |
Корейский | fullwidth text |  |

[NatNum7]

Транслитерации | Native Number Characters | DBNumX | Формат даты
--- | --- | --- | ---
Китайский | short lower case text |  |
Японский | modern short Kanji text |  |
Корейский | informal lower case text |  |

[NatNum8]

Транслитерации | Native Number Characters | DBNumX | Формат даты
--- | --- | --- | ---
Китайский | short upper case text |  |
Японский | traditional short Kanji text | [DBNum4] |
Корейский | informal upper case text |  |

[NatNum9]

Транслитерации | Native Number Characters | DBNumX | Формат даты
--- | --- | --- | ---
Корейский | Hangul characters |  |

[NatNum10]

Транслитерации | Native Number Characters | DBNumX | Формат даты
--- | --- | --- | ---
Корейский | formal Hangul text | [DBNum4] | CAL 9/11/11 [DBNum4]

[NatNum11]

Транслитерации | Native Number Characters | DBNumX | Формат даты
--- | --- | --- | ---
Корейский | informal Hangul text |  |

### Extended LCID

If compatible, native numbering and calendar are exported to Microsoft Excel using extended LCID. Extended LCID can also be used in string format instead of NatNum modifier.

Extended LCID consists of 8 hexadecimal digits: [$-NNCCLLLL], with 2 first digits NN for native numerals, CC for calendar and LLLL for LCID code. For instance, [$-0D0741E] will be converted to [NatNum1][$-41E][~buddhist]: Thai numerals (0D) with Buddhist calendar (07) in Thai locale (041E).

Native Numerals

Two first digits NN represents native numerals:

NN | Numeral | Представление | Compatible LCID
--- | --- | --- | ---
01 | Арабский | 1234567890 | все
02 | Восточно-арабский | ١٢٣٤٥٦٧٨٩٠ | 401 1401, 3c01, 0c01, 801, 2c01, 3401, 3001, 1001, 1801, 2001, 4001, 2801, 1c01, 3801, 2401
03 | Персидский | ۱۲۳۴۵۶۷۸۹۰ | 429
04 | Деванагари | १२३४५६७८९० | 439 44E, 461, 861
05 | Бенгальский | ১২৩৪৫৬৭৮৯০ | 445 845
06 | Панджаби | ੧੨੩੪੫੬੭੮੯੦ | 446
07 | Гуджарати | ૧૨૩૪૫૬૭૮૯૦ | 447
08 | Ория | ୧୨୩୪୫୬୭୮୯୦ | 448
09 | Тамильский | ௧௨௩௪௫௬௭௮௯0 | 449 849
0A | Телугу | ౧౨౩౪౫౬౭౮౯౦ | 44A
0B | Каннада | ೧೨೩೪೫೬೭೮೯೦ | 44B
0C | Малаялам | ൧൨൩൪൫൬൭൮൯൦ | 44C
0D | Тайский | ๑๒๓๔๕๖๗๘๙๐ | 41E
0E | Лаосский | ໑໒໓໔໕໖໗໘໙໐ | 454
0F | Тибетский | ༡༢༣༤༥༦༧༨༩༠ | 851
10 | Бирманский | ၁၂၃၄၅၆၇၈၉၀ | 455
11 | Tigrina | ፩፪፫፬፭፮፯፰፱0 | 473 873
12 | Кхмерский | ១២៣៤៥៦៧៨៩០ | 453
13 | Монгольский | ᠑᠒᠓᠔᠕᠖᠗᠘᠙᠐ | C50 850
1B | Японский | 一二三四五六七八九〇 | 411
1C | (финансовый) | 壱弐参四伍六七八九〇 |
1D | (fullwidth Arabic) | １２３４５６７８９０ |
1E | Chinese - simplified | 一二三四五六七八九○ | 804 1004, 7804
1F | (финансовый) | 壹贰叁肆伍陆柒捌玖零 |
20 | (fullwidth Arabic) | １２３４５６７８９０ |
21 | Chinese - traditional | 一二三四五六七八九○ | C04 1404
22 | (финансовый) | 壹貳參肆伍陸柒捌玖零 |
23 | (fullwidth Arabic) | １２３４５６７８９０ |
24 | Корейский | 一二三四五六七八九０ | 812
25 | (финансовый) | 壹貳參四伍六七八九零 |
26 | (fullwidth Arabic) | １２３４５６７８９０ |
27 | Korean - Hangul | 일이삼사오육칠팔구영 |

Календарь

Two next digits CC are for calendar code. Each calendar is only valid for some LCID.

CC | Календарь | Example (YYYY-MM-DD) | Supported LCID
--- | --- | --- | ---
00 | Григорианский | 2016-08-31 | Все
03 | Gengou | 28-08-31 | 411 (Japanese)
05 | Неизвестно | 4349-08-31 | Неподдерживаемый

06 или 17

Хиджра

1437-11-28

401 (Arabic - Saudi Arabia), 1401 (Arabic - Algeria), 3c01 (Arabic - Bahrain), 0c01 (Arabic - Egypt), 801 (Arabic - Iraq), 2c01 (Arabic - Jordan), 3401 (Arabic - Kuwait), 3001 (Arabic - Lebanon), 1001 (Arabic - Libya), 1801 (Arabic - Morocco), 2001 (Arabic - Oman), 4001 (Arabic - Qatar), 2801 (Arabic - Syria), 1c01 (Arabic - Tunisia), 3801 (Arabic - U.A.E.), 2401 (Arabic - Yemen) and 429 (Farsi)

07 | Буддийский | 2559-08-31 | 454 (Lao), 41E (Thai)
08 | Иудейский | 5776-05-27 | 40D (Hebrew)
10 | Индийский | 1938-06-09 | Неподдерживаемый
0E, 0F, 11, 12 or 13 | Неизвестно | 2016-07-29 | Неподдерживаемый
Неподдерживаемый | Ханча |  | 412 (Korean)
Неподдерживаемый | ROC | 0105-08-31 | 404 (Chinese - Taiwan)

## NatNum12 modifier

To spell out numbers in various number, currency and date formats, use a [NatNum12] modifier with the chosen arguments at the beginning of a number format code.

Common NatNum12 formatting examples

Formatting code | Описание
--- | ---
[NatNum12] | Spell out as cardinal number: 1 → one
[NatNum12 ordinal] | Spell out as ordinal number: 1 → first
[NatNum12 ordinal-number] | Spell out as ordinal indicator: 1 → 1st
[NatNum12 capitalize] | Spell out with capitalization, as cardinal number: 1 → One
[NatNum12 upper ordinal] | Spell out in upper case, as ordinal number: 1 → FIRST
[NatNum12 title] | Spell out in title case, as cardinal number: 101 → Hundred One
[NatNum12 USD] | Spell out as a money amount of a given currency specified by 3-letter ISO code: 1 → one U.S. dollar
[NatNum12 D=ordinal-number]D" of "MMMM | Spell out as a date in format "1st of May"
[NatNum12 YYYY=title year,D=capitalize ordinal]D" of "MMMM, YYYY | Spell out as a date in format "First of May, Nineteen Ninety-nine"
[NatNum12 MMM=upper]MMM-DD | Display upper case abbreviated month name in format "JAN-01"
[NatNum12 MMMM=lower]MMMM | Display lower case month name in format "january"

Other possible arguments: "money" before 3-letter currency codes, for example [NatNum12 capitalize money USD]0.00 will format number "1.99" as "One and 99/100 U.S. Dollars".

## Коды ошибок

If the value is outside the limits for the selected format the following error code is shown:

#FMT