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