These are the codes used in the Format function with examples.
This is a work in progress.
String & Numeric values
Char | Description | Example | |
# | Digit placeholder. Displays either a digit or nothing. Leading and trailing zeros are not displayed. If more digits than placeholders are to the left of the decimal, all digits are displayed. If more digits than placeholders are to the right of the decimal, the fraction is rounded to the number of placeholders. For a dimension, if the placeholder is the leftmost digit, subunits that are 0 are not displayed. | FORMAT(0ft 11.25in,”#.#0u”) | 11.25in. |
, | Thousand’s separator. If surrounded by digit placeholders (# or 0), the separator separates thousands from hundreds within a number that has four or more digits to the left of the decimal. Displays the thousands separator defined for the system’s Region and Language settings (Control Panel). | ||
. | Decimal placeholder. Determines how many digits are displayed to the left and right of the decimal position. In a multipart unit, the decimal is used in the smallest (rightmost) subunit. Displays the decimal character defined for the system’s Region and Language settings (Control Panel). | FORMAT(250 cm,”0.000 u”) | 250.000 cm. |
/ | Fraction placeholder. Displays expression as a whole number with fraction if a leading digit placeholder is present. Otherwise, displays only the whole number in the numerator. If a number follows the digit placeholder in the denominator, rounds the fraction to the nearest fraction whose numerator is 1 and simplifies it. If a number is specified in the denominator without the digit placeholder, rounds to the nearest fraction but does not simplify it. | FORMAT(12.43,”# #/4″) | 12 2/4. |
/u | Fraction placeholder | FORMAT( 0 ft. 11.53 in. , “# #/# u”) | 11 5/9 in. |
0 | Digit placeholder (zero). Displays either a digit or nothing. Leading and trailing zeros are displayed. If more digits than placeholders are to the left of the decimal, all digits are displayed. If more digits than placeholders are to the right of the decimal, the fraction is rounded to the number of placeholders. For a dimension, subunits that are 0 are displayed. | FORMAT(2ft 11.33in,”0.## u”) | 2 ft. 11.33 in. |
Concatenate | If in ft and inches shows ’ or “ | ThePage!PageScale&”” | 2′ |
E- E+ e- e+ | Scientific format. If the format contains at least one digit placeholder to the right of these symbols, the number is displayed in scientific format. Inserts the E or e between the number and its exponent. For E+ or e+, displays the plus (+) sign before positive exponents and the minus (-) sign before negative exponents. For E- or e-, displays the minus (-) sign only when the exponent is negative. | FORMAT(12345.67,”###.#e+#”) | 123.5e+2. |
Nothing | ThePage!PageScale | 2 | |
Space | Displays a space character in the formatted output. To display another character, use the backslash () character. | ||
u | Short label placeholder. Inserts abbreviated unit labels after each subunit. For example: in., ft., deg. The U placeholder inserts mixed-case labels, while the u placeholder inserts lowercase labels. Inserts the same number of spaces before the label as before the placeholder. | FORMAT(12 c 13 d,”#u”) FORMAT( 260.632 cm, “0.## u”) FORMAT( 0ft. 11.53in., “0.000 u”) FORMAT(ThePage!PageScale,”# #/# u”) | 13c1. 260.63 cm. 0 ft. 11.530 in. 2 ft. |
U | Short label placeholder. Inserts abbreviated unit labels after each subunit. For example: in., ft., deg. The U placeholder inserts mixed-case labels, while the u placeholder inserts lowercase labels. Inserts the same number of spaces before the label as before the placeholder. | =FORMAT( 0ft. 11.53in., “0.## U”) FORMAT(ThePage!PageScale,”# #/# U”) | 0 FT. 11.53 IN. 2 FT. |
uu | Long label placeholder. Inserts unit labels after each subunit. For example: inches, feet, degrees The uu placeholder inserts lowercase labels. Inserts the same number of spaces before the label as before the placeholder. | FORMAT(ThePage!PageScale,”# #/# uu”) FORMAT( 260.632 cm, “0 #/# uu”) | 2 feet 260 5/8 centimeters |
UU | Long label placeholder. Inserts unit labels after each subunit. For example: inches, feet, degrees The UU placeholder inserts mixed-case labels. Inserts the same number of spaces before the label as before the placeholder. | FORMAT(ThePage!PageScale,”# #/# UU”) | 2 FEET |
UU | Long label placeholder. Inserts unit labels after each subunit. For example: inches, feet, degrees The U placeholder inserts mixed-case labels, while the u placeholder inserts lowercase labels. Inserts the same number of spaces before the label as before the placeholder. | FORMAT(12.43in,”# #/4 UU”) | 12 2/4 INCHES. |
uuu | Universal label placeholder. Inserts the universal (internal to Visio) form of unit labels after each subunit. The u placeholder inserts lowercase labels. Inserts the same number of spaces before the label as before the placeholder. | FORMAT(ThePage!PageScale,”# #/# uuu”) | 2 ft |
UUU | Universal label placeholder. Inserts the universal (internal to Visio) form of unit labels after each subunit. The U placeholder inserts mixed-case labels. Inserts the same number of spaces before the label as before the placeholder. | FORMAT(ThePage!PageScale,”# #/# UUU”) | 2 FT |
Currency values
Char | Description | Example | |
$ | Currency symbol. Displays the currency symbol defined for the system’s Region and Language settings (Control Panel) | =Format = “$###,###.00” | “$1,200.00” . |
u | Short label placeholder. Inserts the standard symbol for local currency or the three-character currency abbreviations for nonlocal currencies. lowercase. | For example, $99.00, 42.70 FRF. | |
uu | Long label placeholder. Inserts long currency labels after each subunit. lowercase. | For example: U.S. dollar, French franc. | |
uuu | Universal label placeholder. Inserts the universal, three-character currency abbreviations for all currencies after each subunit. lowercase, Inserts the same number of spaces before the label as before the placeholder. | For example, 99.00 USD, 42.70 FRF. | |
U | Short label placeholder. Inserts the standard symbol for local currency or the three-character currency abbreviations for nonlocal currencies. mixed-case labels. | For example, $99.00, 42.70 FRF. | |
UU | Long label placeholder. Inserts long currency labels after each subunit. mixed-case labels. | For example: U.S. dollar, French franc. | |
UUU | Universal label placeholder. Inserts the universal, three-character currency abbreviations for all currencies after each subunit. mixed-case labels. Inserts the same number of spaces before the label as before the placeholder. | For example, 99.00 USD, 42.70 FRF. |
Text values
Char | Description | Example | ||
1 | “text” or ‘text’ | Displays the text enclosed in quotation marks as is. | ||
2 | \ | Displays the next character as is. To display the backslash character, type \. | ||
3 | @ | Text placeholder. Replaces a string if the value of an expression is a string. | FORMAT(“Hello”, “‘You entered (‘@’)'” ) | “You entered (Hello)”. |
4 | @+ | Uppercase text placeholder. For string values, substitutes the input with uppercase. | FORMAT(“Hello”, “@ @+ @-” ) | “Hello HELLO hello)” |
5 | @- | Text placeholder. For string values, substitutes the input with lowercase. | FORMAT(“Hello”, “@ @+ @-” ) | “Hello HELLO hello)”. |
Date values
Char | Description | Example | |
[ ] | Elapsed date placeholder. Used with the d, dd, w, and ww placeholders to display duration units. | For example, [d] or [dd] is elapsed days and [w] or [ww] is elapsed weeks. | |
/ | Date separator. If the expression is a date, separates the date components. Displays the date separator defined for the system’s Region and Language settings (Control Panel). | ||
c or C | Date or time placeholder. Displays date and time values using a short (c) or long (C) date format, and the general time format. Visio versions 4.0 and earlier ignore this placeholder. | FORMAT(DATETIME(“6/25/07 12:05″),”C”) FORMAT(DATETIME(“Jun. 25, 2007″),”c”) | Monday, June 25, 2007 12:05:00 PM. 6/25/2007 |
D | Day placeholder. Displays the day as a number (1-31) without a leading zero. | =FORMAT(DATE(1999,6,7),”d”) | 7 |
Dd | Day placeholder. Displays the day as a number (01-31) with a leading zero. | =FORMAT(DATE(1999,6,7),”dd”) | 07 |
ddd or w | Short day of week placeholder. Displays the day as an abbreviation (Sun-Sat). | =FORMAT(DATE(1999,6,7),”ddd”) | Mon |
dddd | Long date placeholder. Displays a date in the long form defined for the system’s Region and Language settings (Control Panel). | =FORMAT(DATE(1999,6,7),”dddd”) | Monday |
dddd or w | Long day of week placeholder. Displays the day as a full name (Sunday-Saturday). | =FORMAT(DATE(1999,6,7),”dddd”) | Monday |
ddddd | Short date placeholder. Displays a date in the short form defined for the system’s Region and Language settings (Control Panel). | =FORMAT(DATE(1999,6,7),”ddddd”) | 6/7/1999 |
M | Month placeholder. Displays the month as a number (1-12) without a leading zero. See also m (minute placeholder). | =FORMAT(DATE(1999,6,7),”M”) | 6 |
MM | Month placeholder. Displays the month as a number (01-12) with a leading zero. See also mm (minute placeholder). | =FORMAT(DATE(1999,6,7),”MM”) | 06 |
MMM | Month placeholder. Displays the month in abbreviated form (Jan-Dec). | =FORMAT(DATE(1999,6,7),”MMM”) | Jun |
MMMM | Month placeholder. Displays the full name of the month (January-December). | =FORMAT(DATE(1999,6,7),”MMMM”) | June |
Yy | Year placeholder. Displays the year as a two-digit number (00-99). | ||
Yyyy | Year placeholder. Displays the year as a four-digit number (1900-2078). | ||
MMMM_c | Month placeholder for Traditional Chinese. Displays the full name of the month. Independent of the user locale. | ||
D | Day placeholder for Traditional Chinese. Displays the day of the month as the textual representation of the ordinal number. Locale-specific. | ||
D_c | Day placeholder for Traditional Chinese. Displays the day of the month as the textual representation of the ordinal number. Independent of the user locale. | ||
E_c | Year placeholder. For Traditional Chinese, displays a string representing the republic year. Independent of user locale. | ||
EE | Year placeholder. Locale-specific. For Traditional Chinese, displays a string representing the republic year. For Japanese, displays Gengo year as a two-digit Arabic numeral with leading zero if needed. For Korean, displays the Korean year as a four-digit Arabic numeral. | ||
ee_j | Year placeholder. For Japanese, displays Gengo year as a two-digit Arabic numeral. Independent of user locale. | ||
E | Year placeholder. Locale-specific. For Traditional Chinese, Displays string representing the Julian year. For Japanese, Displays Gengo year as one or two digits and no leading zero. For Korean, Displays the Korean year as a four-digit Arabic numeral. | ||
E | Year placeholder. Locale-specific. For Traditional Chinese, Displays a string representing the republic year. For Japanese, Displays Gengo year as one or two digits and no leading zero. For Korean, displays the Korean year as a four-digit Arabic numeral. | ||
e_c | Year placeholder. For Traditional Chinese, Displays string representing the Julian year. Independent of user locale. | ||
Ee | Year placeholder. Locale-specific. For Traditional Chinese, displays string representing the Julian year. For Japanese, displays Gengo year as a two-digit Arabic numeral with leading zero if needed. For Korean, displays the Korean year as a four-digit Arabic numeral. | =FORMAT(DATETIME(1999,6,7),”E”) | 1999 |
e_j | Year placeholder. For Japanese, displays Gengo year as a one- or two-digit Arabic numeral. Independent of user locale. | ||
e_k | Year placeholder. For Korean, displays the Korean year as a four-digit Arabic numeral. Independent of user locale. | ||
G | Year placeholder. Locale-specific. For Japanese, displays short version for Gengo era. For Korean, displays Korean year label followed by a space. | ||
gg or G | Year placeholder. Locale-specific. For Traditional Chinese, displays short version for formal year label. For Japanese, displays short version for Gengo era in Kanji. For Korean, displays Korean year label followed by a space. | ||
gg_c | Year placeholder. For Traditional Chinese, displays short version for formal year label. Independent of user locale. | ||
gg_j | Year placeholder. For Japanese, displays short version for Gengo era in Kanji. Independent of user locale. | ||
gg_k | Year placeholder. For Korean, displays Korean year label followed by a space. Independent of user locale. | ||
ggg_c | Year placeholder. For Traditional Chinese, displays full version for formal year label. Independent of user locale. | ||
ggg_j | Year placeholder. For Japanese, displays full version for Gengo era in Kanji. Independent of user locale. | ||
ggg or GG | Year placeholder. Locale-specific. For Traditional Chinese, displays full version for formal year label. For Japanese, displays full version for Gengo era in Kanji. For Korean, displays Korean year label followed by a space. | ||
g_j | Year placeholder. For Japanese, displays short version for Gengo era. Independent of user locale. | ||
MMMM_e | Month placeholder for English. Displays the full name of the month. Independent of the user locale. | ||
nn or NN | Year placeholder. Locale-specific. For Traditional Chinese, displays the republic year as an Arabic numeral. For Japanese, displays Gengo year as a two-digit Arabic numeral with leading zero if needed. For Korean, displays the Korean year as a four-digit Arabic numeral. | ||
n or N | Year placeholder. Locale-specific. For Traditional Chinese, displays the republic year as an Arabic numeral. For Japanese, displays Gengo year as one or two digits and no leading zero. For Korean, displays the Korean year as a four-digit Arabic numeral. | ||
n_c | Year placeholder. For Traditional Chinese, displays the republic year as an Arabic numeral. Independent of user locale. | Format(Now(), “d-mmm-yyyy hh:nn:ss”) | 29-088-2021 08:2021:36 |
ww_e | Long day of week placeholder for English. Displays the day as a full name (Sunday-Saturday). Independent of the user locale. | =FORMAT(DATE(1999,6,7),”ww”) | Monday |
ww_j | Long day of week placeholder for Japanese. Displays the day as a full name. Independent of the user locale. | ||
w_c or w_c | Day placeholder for Traditional Chinese. Independent of the user locale. | ||
w_e | Short day of week placeholder for English. Displays the day as an abbreviation (Sun-Sat). Independent of the user locale. | =FORMAT(DATE(1999,6,7),”w”) | Mon |
w_j | Short day of week placeholder for Japanese. Displays the day as an abbreviation. Independent of the user locale. | ||
w_k | Short day of week placeholder for Korean. Displays the day as an abbreviation. Independent of the user locale. | ||
w_k | Long day of week placeholder for Korean. Displays the day as a full name. Independent of the user locale. | ||
w_s or w_s | Day placeholder for Simplified Chinese. Independent of the user locale. |
Time values
Char | Description | Example | |
: | Time separator. Displays the time defined for the system’s Region and Language settings (Control Panel). | ||
[ ] | Elapsed time placeholder. Used with the h, hh, m, mm, s, and ss placeholders to display duration units. | For example, [h] or [hh] is elapsed hours, [m] or [mm] is elapsed minutes, and [s] or [ss] is elapsed seconds. | |
H | Hour placeholder. Displays the hour without a leading zero in 24-hour form (0-24). | ||
H | Hour placeholder. Displays the hour without a leading zero in 12-hour form (0-12). | =FORMAT(TIME(15,30,30),”H”) | 15 |
Hh | Hour placeholder. Displays the hour with a leading zero in 12-hour form (00-12). | ||
HH | Hour placeholder. Displays the hour with a leading zero in 24-hour form (00-24). | ||
M | Minute placeholder. Displays the minutes without a leading zero (0-59). | =FORMAT(TIME(15,7,8),”m”) | 7 |
Mm | Minute placeholder. Displays the minutes with a leading zero (00-59). | =FORMAT(TIME(15,7,8),”mm”) | 07 |
T | AM/PM abbreviation. Displays the abbreviation defined for the system’s Region and Language settings (Control Panel). | =FORMAT(TIME(15,7,8),”T”) | 3:07:08 PM |
T | General time format. | ||
Tt | AM/PM designator. Displays the full designator defined for the system’s Region and Language settings (Control Panel). | ||
t_c or tt_c | Traditional Chinese AM/PM designator. Displays the designator. Independent of user locale. | ||
t_e | English AM/PM designator. Displays the short designator. Independent of user locale. | ||
tt_e | English AM/PM designator. Displays the full designator. Independent of user locale. | ||
t_j or tt_j | Japanese AM/PM designator. Displays the designator. Independent of user locale. | ||
t_k or tt_k | Korean AM/PM designator. Displays the designator. Independent of user locale. | ||
S | Second placeholder. Displays the seconds without a leading zero (0-59). | =FORMAT(TIME(15,7,8),”s”) | 8 |
Ss | Second placeholder. Displays the seconds with a leading zero (00-59). | =FORMAT(TIME(15,7,8),”ss”) | 08 |
t_s or tt_s | Simplified Chinese AM/PM designator. Displays the designator. Independent of user locale. | ||