Skip to main content

How to add thousand separators to numbers in Word documents?

Author Sun Last modified

Adding thousand separators to numbers in a Word document can greatly enhance readability, especially when dealing with large figures. While Microsoft Word does not have a direct feature for adding thousand separators, there are efficient methods to achieve this using VBA (Visual Basic for Applications) or a handy tool like Kutools for Word.

In this tutorial, we will guide you through the steps to add thousand separators to numbers in your Word document using both VBA and Kutools for Word.

Add thousand separators with VBA

Add thousand separators with Kutools for Word good idea


Add thousand separators with VBA

Inserting thousand separators into large numbers can be tedious, especially if you need to do it repeatedly. By using VBA code, you can automate this process, allowing you to simply select a number and press F5 to instantly add the separators.

  1. Select the number you want to format with thousand separators, then press Alt + F11 to open the Microsoft Visual Basic for Applications window.
  2. Click Insert > Module, then copy and paste the following code into the Module editor.
    Sub InsertThousandSeparators()
        Dim selectedText As String
        Dim formattedText As String
        Dim decimalPos As Integer
        Dim wholePart As String
        Dim decimalPart As String
        Dim temp As String
        Dim i As Integer
        Dim charCount As Integer
        Dim trailingSpace As String
        Dim trailingParagraphMark As String
        
        If Selection.Type <> wdSelectionIP Then
            selectedText = Selection.Text
            trailingSpace = ""
            trailingParagraphMark = ""
            
            If Right(selectedText, 1) = " " Then
                trailingSpace = " "
                selectedText = Trim(selectedText)
            End If
            
            If Right(selectedText, 1) = Chr(13) Then
                trailingParagraphMark = Chr(13)
                selectedText = Left(selectedText, Len(selectedText) - 1)
            End If
            
            If IsNumeric(selectedText) Then
                decimalPos = InStr(1, selectedText, ".")
                
                If decimalPos > 0 Then
                    wholePart = Left(selectedText, decimalPos - 1)
                    decimalPart = Mid(selectedText, decimalPos + 1)
                Else
                    wholePart = selectedText
                    decimalPart = ""
                End If
                
                wholePart = Replace(wholePart, ",", "")
                
                temp = ""
                charCount = 0
                
                For i = Len(wholePart) To 1 Step -1
                    temp = Mid(wholePart, i, 1) & temp
                    charCount = charCount + 1
                    
                    If charCount Mod 3 = 0 And i > 1 Then
                        temp = "," & temp
                    End If
                Next i
                
                wholePart = temp
                
                If decimalPart <> "" Then
                    formattedText = wholePart & "." & decimalPart
                Else
                    formattedText = wholePart
                End If
                
                Selection.Text = formattedText & trailingSpace & trailingParagraphMark
            Else
                MsgBox "Please select a valid number."
            End If
        Else
            MsgBox "Please select a number first."
        End If
    End Sub
  3. Press the F5 key, and the thousand separators will be added to the selected number.

    Thousand separators are inserted into the selected number

  4. To add separators to another number, simply select the new number and then go back to the Module window and press F5 again.

Add thousand separators with Kutools for Word

If you want to insert separators to multiple numbers in a selection or the entire Word document, the Add Thousand Separator utility of Kutools for Word can solve this job with just a few clicks.

Kutools for Word, equipped with AI πŸ€–, offers over 100 handy features to simplify your tasks.

After installing Kutools for Word, follow these steps:

  1. For adding thousand separators to all numbers in the entire document, do not select any data, and click Kutools > Insert > Add Thousand Separator.
    Add Thousand Separator option on the Kutools tab on the ribbon
  2. A dialog pops up asking if you want to apply this function to the whole document, click Yes.
    Confirmation dialog saying 'Do you want to add thousand separators to all numbers in the whole document?'
  3. Now, all numbers have had thousand separators inserted.
    Thousand separators are inserted into all numbers

Notes:

  • If you want to add thousand separators to numbers in a specific selection, select the section first, and then click Kutools > Insert > Add Thousand Separator.
    Thousand separators are inserted into numbers in the selected range
  • To remove the thousand separators, click Kutools > Remove > Remove All Thousand Separators in Selected Ranges.
    Remove Thousand Separators option on the Kutools tab on the ribbon

Demo: Add thousand separators to numbers in a Word document

Discover the Kutools / Kutools Plus tab in this video from Kutools for Word. Enjoy 100+ features and permanently free AI utilities. Download now!

Best Office Productivity Tools

Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!

πŸ€– Kutools AI Features: AI Assistant / Real-Time Assistant / Super Polish (Preserve Format) / Super Translate (Preserve Format) / AI Redaction / AI Proofread...

πŸ“˜ Document Mastery: Split Pages / Merge Documents / Export Selection in Various Formats (PDF/TXT/DOC/HTML...) / Batch Convert to PDF...

✏ Contents Editing: Batch Find and Replace across Multiple Files / Resize All Pictures / Transpose Table Rows and Columns / Convert Table to Text...

🧹 Effortless Clean: Sweap away Extra Spaces / Section Breaks / Text Boxes / Hyperlinks / For more removing tools, head to the Remove group...

βž• Creative Inserts: Insert Thousand Separators / Check Boxes / Radio Buttons / QR Code / Barcode / Multiple Pictures / Discover more in the Insert group...

πŸ” Precision Selections: Pinpoint Specific Pages / Tables / Shapes / Heading Paragraphs / Enhance navigation with more Select features...

⭐ Star Enhancements: Navigate to Any Location / Auto-Insert Repetitive Text / Toggle Between Document Windows / 11 Conversion Tools...

🌍 Supports 40+ Languages: Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Kutools and Kutools Plus tabs on the Word Ribbon
πŸ‘‰ Want to try these features? Download Kutools for Word now! πŸš€
 

Best Office Productivity Tools

Kutools for Word - 100+ Tools for Word