Collabora Office 24.04 Help
Converts a numeric expression to a string, and then formats it according to the format that you specify.
Format(expression [, format As String]) As String
expression: Numeric expression that you want to convert to a formatted string.
format: String that specifies the format code for the number. If format is omitted, the Format function works like the Collabora Office Basic Str() function.
Text string.
The following list describes the codes that you can use for formatting a numeric expression:
0: If expression has a digit at the position of the 0 in the format code, the digit is displayed, otherwise a zero is displayed.
If expression has fewer digits than the number of zeros in the format code, (on either side of the decimal), leading or trailing zeros are displayed. If the expression has more digits to the left of the decimal separator than the amount of zeros in the format code, the additional digits are displayed without formatting.
Decimal places in the expression are rounded according to the number of zeros that appear after the decimal separator in the format code.
#: If expression contains a digit at the position of the # placeholder in the format code, the digit is displayed, otherwise nothing is displayed at this position.
This symbol works like the 0, except that leading or trailing zeroes are not displayed if there are more # characters in the format code than digits in the expression. Only the relevant digits of the expression are displayed.
.: μμμ μ리 νμμλ μμ κ΅¬λΆ κΈ°νΈ μΌμͺ½ λ° μ€λ₯Έμͺ½μ μμμ μ΄ν μλ¦Ώμλ₯Ό κ²°μ ν©λλ€.
If the format code contains only # placeholders to the left of this symbol, numbers less than 1 begin with a decimal separator. To always display a leading zero with fractional numbers, use 0 as a placeholder for the first digit to the left of the decimal separator.
%: Multiplies the expressionby 100 and inserts the percent sign (%) where the expression appears in the format code.
E- E+ e- e+ : If the format code contains at least one digit placeholder (0 or #) to the right of the symbol E-, E+, e-, or e+, the expression is formatted in the scientific or exponential format. The letter E or e is inserted between the number and the exponent. The number of placeholders for digits to the right of the symbol determines the number of digits in the exponent.
μ§μκ° μμμΌ κ²½μ° E-, E+, e- λλ e+ κΈ°νΈκ° μλ μ§μμ λ°λ‘ μμ λΉΌκΈ° κΈ°νΈκ° νμλ©λλ€. μ§μκ° μμμΌ κ²½μ° E+ λλ e+ κΈ°νΈκ° μλ μ§μμ μμλ§ λνκΈ° κΈ°νΈκ° νμλ©λλ€.
The thousands delimiter is displayed if the format code contains the delimiter enclosed by digit placeholders (0 or #).
λ§μΉ¨νλ₯Ό μ²λ¨μ λ° μμ κ΅¬λΆ κΈ°νΈλ‘ μ¬μ©ν μ§ μ¬λΆλ κ΅κ°λ³ μ€μ μ λ°λΌ κ²°μ λ©λλ€. Basic μλ³Έ μ½λμ μ§μ μ«μλ₯Ό μ λ ₯νλ κ²½μ° νμ λ§μΉ¨νλ₯Ό μμ κ΅¬λΆ κΈ°νΈλ‘ μ¬μ©ν©λλ€. μμ κ΅¬λΆ κΈ°νΈλ‘ νμλλ μ€μ λ¬Έμλ μμ€ν μ€μ μ μ«μ νκΈ° νμμ λ°λΌ λ¬λΌμ§λλ€.
- + $ ( ) space: A plus (+), minus (-), dollar ($), space, or brackets entered directly in the format code is displayed as a literal character.
μ¬κΈ°μ λμ΄λ κ² μΈμ λ¬Έμλ₯Ό νμνλ €λ©΄ ν΄λΉ λ¬Έμ μμ λ°±μ¬λμ(\)λ₯Ό μ¬μ©νκ±°λ ν΄λΉ λ¬Έμλ₯Ό λ°μ΄ν(" ")λ‘ λ¬Άμ΄μΌ ν©λλ€.
\ : The backslash displays the next character in the format code.
Characters in the format code that have a special meaning can only be displayed as literal characters if they are preceded by a backslash. The backslash itself is not displayed, unless you enter a double backslash (\\) in the format code.
리ν°λ΄ λ¬Έμλ‘ νμνκΈ° μν΄ μμ μ½λμμ λ°±μ¬λμλ₯Ό μμ λμ΄μΌ νλ λ¬Έμλ‘λ λ μ§ λ° μκ° μμ μ€μ λ¬Έμ(a, c, d, h, m, n, p, q, s, t, w, y, /, :), μ«μ νκΈ° νμ μ€μ λ¬Έμ(#, 0, %, E, e, μΌν, λ§μΉ¨ν) λ° λ¬Έμμ΄ μμ μ€μ λ¬Έμ(@, &, <, >, !) λ±μ΄ μμ΅λλ€.
You can also use the following predefined number formats. Except for "General Number", all of the predefined format codes return the number as a decimal number with two decimal places.
미리 μ§μ λ μμμ μ¬μ©ν κ²½μ° μμ μ΄λ¦μ λ°μ΄νλ‘ λ¬Άμ΄μΌ ν©λλ€.
General Number: μ«μλ₯Ό μ λ ₯ν λλ‘ νμν©λλ€.
Currency: μ«μ μμ λ¬λ¬ κΈ°νΈλ₯Ό μ½μ νκ³ μμλ₯Ό κ΄νΈλ‘ λ¬Άμ΅λλ€.
Fixed: μμ κ΅¬λΆ κΈ°νΈ μμ μ΅μν νλ μ΄μμ μ«μλ₯Ό νμν©λλ€.
Standard: μ«μλ₯Ό μ²λ¨μ κ΅¬λΆ κΈ°νΈμ ν¨κ» νμν©λλ€.
Percent: μ«μμ 100μ κ³±νκ³ λ°±λΆμ¨ κΈ°νΈλ₯Ό μ«μμ μΆκ°ν©λλ€.
Scientific: μ«μλ₯Ό 곡νμ© μμμΌλ‘ νμν©λλ€(μ: 1000μ κ²½μ° 1.00E+03μΌλ‘ νμ).
A format code can be divided into three sections that are separated by semicolons. The first part defines the format for positive values, the second part for negative values, and the third part for zero. If you only specify one format code, it applies to all numbers.
Sub ExampleFormat
MsgBox Format(6328.2, "##,##0.00")
REMμ μ¬μ©μκ° Basic μλ³Έ μ½λμ μ«μλ₯Ό μ
λ ₯ν λ νμ λ§μΉ¨νλ₯Ό μμ κ΅¬λΆ κΈ°νΈλ‘ μ¬μ©ν©λλ€.
REM displays for example 6,328.20 in English locale, 6.328,20 in German locale.
End Sub