Word number \# field code formatting explained

All about the \# formatting switch in Word field codes lets you change the look of numbers in many different ways. Many examples plus a guide to the formatting codes.

Use these options with Word fields that return a number like SEQ, REF, PAGE, SECTION, SECTIONPAGES, AUTONUM, EDITTIME, FILESIZE and MERGEFIELD . The \# codes let you change how the number appears in the document with different settings for positive or negative numbers plus zero.

\# is more flexible and powerful than the named \* formatting codes but the \* options are much easier to understand and use.

The \# formatting in Word field codes is similar to Excel’s custom number cell formats but not exactly the same. That’s because Word and Excel were separate programs and these features existed long before both apps became part of Microsoft Office.

Digits with two decimal places

\# “0.00”- displays results as a decimal e.g., 10 displays as 10.00

Commas and two decimal places

\# “#,##0.00”– displays with thousands commas and two decimal places e.g. 1110 displays as 1,110.00

Digits with leading zeros

\# “000000” Use this for serial numbers, product codes, ticket numbers etc. Add as many 0’s as you want to the formatting code.

Percentage, whole number.

\# “0%”- displays results as a percentage e.g., 110 displays as 110%.

For larger percentages, use “ \# “#,##0% “ to add commas.

This is different to Excel where a fractional cell value can appear as a percentage. For example in Excel, 0.03 appears as 3% while value 3 shows as 300%.

Percentage with two decimal places

\# “0.00%”– displays results as a decimal percentage e.g., 10 displays as 10.00%

Dollar with negative value

\# “$#,##0.00;($#,##0.00)” Separate formatting for a negative is possible, just add a semi-colon and then another number format.

Dollar with negative and zero options

\# “$#,##0.00;($#,##0.00);Zero” Even a special format for zero is possible. Add a second semi-colon (after the negative format) then whatever value or text you’d like.

Understanding the number formatting codes

Now you’ve seen some examples, some of the rules for number formatting (what’s inside the double quotes) might be clearer

0 – any number, if there’s no digit in that position, add a zero.

#  – any number, if no digit in that position, nothing

; – semi-colon separates different formats for positive;negative;zero in that order.

Zero – the third of the formatting options after the second semi-colon.

$  %  £ € ¥ °  – these and many other symbols are added ‘as is’

( ) – add visible brackets

Bold, Italic, Highlighting – apply desired formatting to the format string.

Different colors for positive, negative or zero – change text color of the format string

Or use the named \* number formatting options.

Word field codes for everyone
All the \* named format switches for Word field codes
Word field codes, changing the color or format based on the number
Choices for formatting fields in Word Mail Merge

Join Office for Mere Mortals today

Office for Mere Mortals is where thousands pick up useful tips and tricks for Word, Excel, PowerPoint and Outlook.

Give it a try. You can unsubscribe at any time.  We've never spammed or sold addresses since we started over twenty years ago.
Invalid email address