Format expression rules

A format expression for strings can have one section or two sections separated by a semicolon (;).

If you use

The result is

One section only

The format applies to all string data.

Two sections

The first section applies to string data, the second to Null values and zero-length strings ("").

A user-defined format expression for numbers can have from one to four sections separated by semicolons. If the format argument contains one of the named numeric formats, only one section is allowed.

If you use

The result is

One section only

The format expression applies to all values.

Two sections

The first section applies to positive values and zeros, the second to negative values.

Three sections

The first section applies to positive values, the second to negative values, and the third to zeros.

Four sections

The first section applies to positive values, the second to negative values, the third to zeros, and the fourth to Null values.