Filling Table Cells with Sequential Numbers

by Allen Wyatt
(last updated April 22, 2017)

2

Denis frequently uses tables in his documents. In those tables, he has a need to add a series of sequential numbers to the cells in the first column. Denis wonders if there is a way to pick a starting number in a cell and then have Word add the sequential numbers for all the cells under that starting number.

There are a couple of ways you could go about this. One way is to use Word's built-in numbering, in this manner:

  1. Insert your table as you normally would.
  2. Select the cells in the table that you want to have numbered.
  3. Display the Home tab of the ribbon.
  4. Click the Numbering tab, in the Paragraph group. Word adds numbering, automatically, to the selected cells.

If you want to modify the starting number for the cells, right-click the number in the first cell and then choose Set Numbering Value from the resulting Context menu. Word displays the Set Numbering Value dialog box. (See Figure 1.)

Figure 1. The Set Numbering Value dialog box.

Enter the value you want to start with, and when you click OK, Word updates the numbers in the cells. You'll also note that if you insert any rows in the middle of your numbered sequence, Word automatically adds a number to that inserted row.

Noting this behavior, you might appreciate a simple variation on the above process that works well when you are inserting a brand new table:

  1. Insert a single-row table.
  2. Add the automatic number to the desired column and change its starting value, if desired. (In other words, follow the steps above for the single cell in the row.)
  3. When entering data in the table and you get to the last column, press Tab and Word inserts a new row that is automatically numbered.

Another powerful way to add your numbering is to use the SEQ field. Follow these general steps:

  1. Insert the insertion point at the place in the table where you want the first number.
  2. Press Ctrl+F9 to insert an empty set of field braces.
  3. Inside the field braces, type SEQ followed by a space, then a name you want used for this particular sequence, then another space, then \r, then the number you want the sequence to start with. Here's an example of how the field code would appear if you wanted to start counting with the number 4:
  4.      { SEQ table1 \r4 }
    
  5. With the insertion point still within field code, press Shift+F9. Your number should appear.
  6. Repeat steps 2 through 4 for each of the other cells where you want a number, but make sure you leave off the \r switch in these others.

Finally, if you prefer to use a macro to insert numbers in a sequence of cells, you could use one similar to this:

Sub AddNumbersToTable()
    Dim RowNum As Long
    Dim ColNum As Long
    Dim iStartNum As Integer
    Dim J As Integer

    If Selection.Information(wdWithInTable) Then
        RowNum = Selection.Cells(1).RowIndex
        ColNum = Selection.Cells(1).ColumnIndex

        iStartNum = Val(Selection.Cells(1).Range.Text)
        If iStartNum <> 0 Then
            iStartNum = iStartNum + 1

            For J = RowNum + 1 To ActiveDocument.Tables(1).Rows.Count
                ActiveDocument.Tables(1).Cell(J, ColNum).Range.Text = iStartNum
                iStartNum = iStartNum + 1
            Next
        Else
            MsgBox "Cell doesn't contain a non-zero starting number."
            Exit Sub
        End If
    Else
        MsgBox "Not in table"
    End If
End Sub

To use the macro, just put a starting sequence value into a cell of the table and leave the insertion point in that cell. When you then run the macro, all the cells under that starting cell are filled with sequential values. (Anything previously in those cells is deleted.)

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (89) applies to Microsoft Word 2007, 2010, 2013, and 2016.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Templates and Page Setup

Templates are a great way to share styles, macros, and other settings among various documents. One thing that isn't shared ...

Discover More

Selecting a Cell in the Current Row

Macros often need to select different cells in a worksheet. Here's how you can use macro commands to change which cell is ...

Discover More

Extracting a Pattern from within Text

If you have a large amount of data in a worksheet and you want to extract information from the text that meets certain ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Summing a Table Column

Need to add a sum to a column of figures in a table? Word makes it relatively easy to provide the sum you need.

Discover More

Counting Values in Table Cells

In Excel it is easy to count how many times a certain character occurs in a column of cells. In Word, it is a bit trickier. ...

Discover More

Drop Shadows for Tables

When adding borders and shading to a document's elements, Word allows you to quickly add drop shadows to paragraphs, text ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is eight minus 2?

2017-04-24 04:22:50

Ken Endacott

An easier way is to setup the table in Excel and use the Excel features to create sequential numbering. The cells making up the whole table can then be selected and copied into a Word document using CTRL/C and CTRL/V which will create a table in Word. Column widths and borders can be set up in Excel and cells can be filled in before copying to the Word document.

If the table already exists then select the table, copy to Excel, setup the numbering and copy the table back to Word.

As well as sequential numbers, Excel can create sequential dates and perform arithmetic on the cell contents.


2017-04-23 07:16:54

Debby D.

For years, I've applied an autonumbered style to the first cell I want to be sequentially numbered. When I add rows, the cells immediately below continue that same numbered style whether I add them by tabbing from the end of the last row or by using the commands to inserts rows above or below. Because the numbering is part of a style, it can continue from one table to another, but it can always be restarted. I can even skip a row by changing the style for the particular cell or by just toggling off the numbering. I also use it to show two levels of numbering in a single cell by creating two autonumbered styles in a hierarchy that works just like Heading 1 and Heading 2.


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.