The Format method is a special kind of text formula that can be used to replace all {} items within a string or paragraph with corresponding data listed at the end, which can be numerical, or text, or date data.


The formula starts with the string or paragraph followed by one or more objects or expressions that will be converted to strings and inserted at a specified place in the format string. For example, the formula:


Format("The high temperature on {0:d} was {1:n1} ⁰F or {2:n2} ⁰C",[date],[num1],[num2])


replaces the formatted items in a string with the string representations of the listed objects. In this example, the output would be: "The high temperature on 3/28/2020 was 47.3 ⁰F or 8.52⁰C".


The {0:d} item above applies the "d" format (date) to the first object in list. The {1:n1} item refers to a number with one digit after the decimal.


Each formatted item must have the opening and closing braces. A format item has this syntax:


{index[,alignment][:formatString]}


where the brackets indicate optional parameters.


index (required) - The zero-based index of the argument whose string representation is to be included at this position in the string.


alignment (optional) - A signed integer that indicates the total length of the field into which the argument is inserted and whether it is right-aligned (a positive integer) or left-aligned (a negative integer). If not specified, the argument is inserted at the corresponding position with no leading or trailing spaces.


formatString (optional) - A string that specifies the format of the corresponding argument's result string. This can be one of the following letters: t (time), d (date), n (number), c (currency), and p (percentage). Text values don't need this specifier. If omitted, a ToString method will be used to produce its string representation. An optional integer after the letter indicates decimal precision.