Microsoft Office Tutorials and References
In Depth Information
Controlling field formatting by using switches
Controlling field formatting by using switches
You can control the appearance of fields that produce numbers,
dates, or text as their field results by using optional switches
that modify the result in the way that you specify.
In addition to the following special characters, you can include
other text, punctuation, and spaces in the expression:
Uppercase M for the month. One M displays the month
as a one or two-digit number, but MM displays all months
with two digits including a leading zero, if needed. The
three-character MMM displays the month as a three-letter
abbreviation, and the four-character MMMM spells out
the month’s name in full.
Uppercase or lowercase d for the day. One d displays the
day of the month as a one or two-digit number, but dd
displays all days with two digits including a leading zero,
if needed. The three-character ddd displays the day of the
week as a three-letter abbreviation, and the four-character
dddd spells out the day of the week in full.
Uppercase or lowercase y for the year. One y or the
two-character yy displays the last two digits of the year;
the four-character yyyy displays the four-digit year. The
three-character yyy displays an error message.
Uppercase H for the hour based on the 24-hour clock.
One H displays the hour without a leading zero, and the
two-digit HH displays the hour with a leading zero, if
needed.
Lowercase h acts like uppercase H except that it displays
the hour based on the 12-hour clock. Use this character
with the AM/PM expression.
Lowercase m for the minute. One m displays the minute
without a leading zero; the two-digit mm displays the
minute with a leading zero, if needed.
In a field that produces a numeric result, you can insert a
numeric picture switch that consists of the characters \# fol-
lowed by a quoted expression that describes the desired
format. In that expression, the following characters have special
meanings:
The character 0 (zero) indicates a required digit in the
result, which appears as a zero if no other digit would be
there. For example, the field { = 2 + 3 \# “$00.0” } displays
the result $05.0.
The character # indicates a required digit, in the same
way as the character 0, except that it displays a space if no
digit would be there. For example, the field { = 2 + 3 \#
“$#0.0” } displays the result $ 5.0.
If you include two or three format expressions separated
by semicolons, the first expression is used if the result is
a positive number, the second one is used if the result is
a negative number, and the third one is used if the result
is zero. For example, a field in the bottom cell of a table’s
column might be { =SUM(ABOVE) \# “$0.00;- $0.00;NA” }.
If the total of the numbers in the column is positive, the
field displays it with a dollar sign and two decimal places;
if the total is negative, the field displays it with a minus
sign; and if the total is zero, the field displays the charac-
ters NA.
In a field that produces a date as the result, you can insert a
date-time picture switch that consists of the characters \@ fol-
lowed by a quoted expression that describes the desired format.
Search JabSto ::




Custom Search