Microsoft KB Archive/142778

= WD: How to Use a Conditional Field to Specify a Number of Digits =

Article ID: 142778

Article Last Modified on 8/17/2005

-

APPLIES TO


 * Microsoft Word 6.0 Standard Edition
 * Microsoft Word 6.0a
 * Microsoft Word 6.0c
 * Microsoft Word 95 Standard Edition
 * Microsoft Word 95a
 * Microsoft Word 98 for Macintosh
 * Microsoft Word 6.0 for Macintosh
 * Microsoft Word 6.01 for Macintosh
 * Microsoft Word 6.01 for Macintosh
 * Microsoft Word 6.0 Standard Edition

-



This article was previously published under Q142778



SUMMARY
This article describes how to specify a numeric format switch within a nested {IF} field to control the number of leading zeros in a numeric result. The formula allows you to format numbers that contain an unequal number of digits, such as 10, 100, and 1000, as numbers that contain an equal number of digits, such as 0010, 0100, and 1000.



MORE INFORMATION
Use a numeric picture switch (\#) to specify the number of digits for the result. For example, if your number is to contain five digits, use the following numeric picture switches within the conditional formula: \# 0000#  \# 000##   \# 00###   \# 0#### Create the following conditional {IF} field:

{if { MERGEFIELD number } > "9" { if { MERGEFIELD number } > "99" { if {MERGEFIELD number } > "999" { if { MERGEFIELD number } > "9999" { MERGEFIELD number } { MERGEFIELD number \# 0#### }}{ MERGEFIELD number \# 00### }}{ MERGEFIELD number \# 000## }}{MERGEFIELD number \# 0000# }}

Additional query words: nested conditional 8.0 8.00

Keywords: kbhowto kbfield KB142778

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.