litLIB Help
Product pages :
Quick links:
help index

String - Format

=Format(Expression, FormatString, Optional FirstDayOfWeek As Variant, Optional FirstWeekOfYear)

Formats an expression according to the format string and options specified. Equivalent to the Visual Basic Format function.

Expression : the value to format
FormatString : the string that denotes the format that should be applied. Use the format strings you use in Visual Basic.
FirstDayofWeek : Optional. This constant specifies which day is considered to be the start of the week. 0 is the system default, 1 is Sunday, 2 is Monday, 3 is Tuesday, and so on.
FirstWeekOfYear : Optional. This constant specifies the first week of the year. If not specified the first week of the year is considered the week of January the 1st.  0 is the system default, 1 is week of January the 1st, 2 starts with the week that has at least 4 days, 3 starts the year with the first full week.

Format a number as 1.20
Format a number with a thousand separator and two decimals
Format a number as percentage
=Format(0.051," 0.00 %")
Format a string as lower case
Format a string as upper case
Format the current date as a Long Date
=Format(NOW(),"Long Date")
Format the current date and time as a Long Time
=Format(NOW(),"Long Time")