Word: Insert a zero in front of single digit numbers

January 14, 2014

If you don’t use Word’s auto numbering and you copy numbered content from another source (e.g. an Excel spreadsheet), you may end up with something like this:


If you sort on the first column and don’t specify that it’s a Number column type, you could end up with something like this, where 10, 11 etc. come after 1 and not after 9:


In such circumstances you may want to add a zero in front of the single-digit numbers so that you can sort them properly. While you can do this manually, which is quick and easy if you only have a few, that becomes tedious if you have many tables or lists in your document that have a mix of one- and two-digit manual numbers and you want to change all the single-digit numbers to two-digit numbers, with a zero in front, like this:


Enter Find and Replace using wildcards!

What you’re going to do is look for any single-digit number followed by a period, and then add a zero to the front of the number while keeping the number and its trailing period.

Here’s how:

  1. Select the table column or paragraphs that contain the numbers you want to change. (See NOTE below about this selection.)
  2. Press Ctrl+H to open the Find/Replace window on the Replace tab.
  3. Click More.
  4. Select the Use wildcards check box.
  5. In the Find what field, type this: (<[0-9])(.) (Note: make sure you type this exactly as written — you might find it easier to copy/paste this instead.)
  6. In the Replace with field, type this: 0\1\2 (Note: the first character is a zero.)
  7. Click Replace All.
  8. When asked if you want to search the remainder of the document, click No (unless of course you really do want to replace all instances of a single-digit number followed by a period in the rest of the document!)
  9. Thank me by donating to this blog if I’ve just saved you a heap of time ;-)

Explanation for what the wildcards mean:

  • (<[0-9]): Find a range ( ) starting with (<) a single number between 0 and 9 [0-9]
  • (.): followed by a period
  • 0: Replace with a zero
  • \1: followed by whatever was found in the first range (the single number)
  • \2: followed by whatever was found in the second range (the period)

NOTE: There’s a quirk in Find/Replace whereby Replace All replaces across the entire document if you click Replace or Find Next first. See this blog post for details: https://cybertext.wordpress.com/2014/01/13/word-replace-all-doesnt-work-on-selected-text-only/

[Link last checked January 2014]


  1. To be a tad pedantic, perhaps, more correctly:

    <([0-9]) Find the beginning of a word (matching to "<"), followed by any single digit in the range 0-9…. , etc… given that we don't and can't capture the logical point where a word starts, ie, it doesn't need to be inside the brackets ?

    Meanwhile, it's a pity Microsoft couldn't adopt regular expressions in the more popular and useful formats others use — but then, what are common standards for ?

  2. Thanks Peter. I figured there was probably a better way to do it. After a lot of experimenting, I got my way to work, but always knew that it may not be the most efficient.

  3. Hey, if it works, it works… If there’s a performance difference, humans won’t see it. It’s just that if you extend the expression later for sslightly different purposes, some magic might get confused… And it’s better not to confuse refer magic. That makes brains hurt. :-)

  4. Thank you, Rhonda, for the post. It sure can save a “heap of time” for me. But, unfortunately, all I can donate as of now is my time to read your posts! ;)

  5. Thank you.
    I need an code to Find decimal number like 2.13 and Replace with transpose number 13.2, Change location of decimal and integer digit in a number.

  6. Hi Reza

    You could use a wildcard find/replace for this, but you’d need to be careful about not replacing ones that shouldn’t be replaced, so don’t do a ‘replace all’ – just replace one at a time, and skip those that shouldn’t be replaced.

    You’d need to find: ([0-9]{1,5})(.)([0-9]{1,5})
    And replace with: \3\2\1


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: