How do I have Word automatically insert commas and decimals in figures in a Word document?

Anonymous
2022-11-26T06:31:08+00:00

Hi,

I just found this link: https://answers.microsoft.com/en-us/msoffice/forum/all/how-do-i-insert-auto-commas-on-figures-on-a-word/0e39af06-7981-e011-9b4b-68b599b31bf5.

The user in the second-to-last post on this page said "I'd like to be able to enter 1234567 and get $1,234,567". This is what I would like to do in Word also.

I thought the link in last post was going to answer my question. However, it refers to this link: http://office.microsoft.com/en-us/word-help/numeric-picture-field-switch-HP005186226.aspx, which is something unrelated.

Thanks in advance.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

13 answers

Sort by: Most helpful
  1. Doug Robbins - MVP - Office Apps and Services 322.1K Reputation points MVP Volunteer Moderator
    2022-11-26T07:30:53+00:00

    If you insert a Legacy Text Form Field where you want the number

    You can then go to the Properties dialog for the FormField and set the type as Number and then select the formatting for the number that you want

    FOR THAT TO WORK HOWEVER, THE DOCUMENT MUST BE PROTECTED FOR FILLING IN FORMS, which will severely restrict other things that you can do with the document.

    Alternatively, if you insert Content Controls where you want to enter the numbers and you set the Title of each of those Content Controls to "Number", if you have the following code in the ThisDocument object for the document, (or of the Template from which the document is created), the desired formatting will be applied if a number is entered into the Content Control

    Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)

    Dim CC As ContentControl

    With ActiveDocument

    For Each CC In .ContentControls 
    
        If CC.Title = "Number" And IsNumeric(CC.Range.Text) Then 
    
            CC.Range.Text = Format(CC.Range.Text, "#,##0.00") 
    
        End If 
    
    Next CC 
    

    End With

    End Sub

    Either the document, or the template from which it is created will need to be saved in Macro enabled format.

    2 people found this answer helpful.
    0 comments No comments
  2. Paul Edstein 82,826 Reputation points Volunteer Moderator
    2022-11-26T12:34:42+00:00

    Did you read my post in the thread in the first link you posted? It includes a macro to apply such formatting to numbers in a selected table.

    2 people found this answer helpful.
    0 comments No comments
  3. Suzanne S Barnhill 275K Reputation points MVP Volunteer Moderator
    2022-11-26T13:00:23+00:00

    The link is not unrelated; it explains how to format numbers in fields. Apparently you are asking to format numbers that are not field results, so Doug's and Paul's solutions will be what you need.

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2022-11-26T19:54:26+00:00

    The link it is giving me is not showing that.

    0 comments No comments
  5. Paul Edstein 82,826 Reputation points Volunteer Moderator
    2022-11-26T21:35:54+00:00

    The link it is giving me is not showing that.

    That is precisely what my post in the thread in the first link you posted does address.

    1 person found this answer helpful.
    0 comments No comments