Glam Prestige Journal

Bright entertainment trends with youth appeal.

I am working with loads of tables in Microsoft Word 2010. I would like to limit the numbers I have to three decimals places, along with rounding them.

For example: 0.1234 will become 0.123 and 1.6789 will become 1.679. It is a simple task but I wasn't able to find the way to do this.

Note: for numbers ending with zeros: I would prefer to have them as 1.3 instead of 1.300 if there's a way to do that!

5

1 Answer

There doesn't seem to be a built-in way to do this in Word. There are a couple of options I can think of but neither are ideal.

  1. Download and install LibreOffice. Its word processor (Writer) has the option to set data formats in table cells, which can be accessed by highlighting the cells, right-clicking and choosing the Data Format... option. Once you are done you can save it back out to .docx format, although its possible you might lose some formatting depending on what Word features you are using. Once saved as .docx the data type information isn't saved so the numbers won't be stay rounded if you edit them later.

    enter image description here

  2. Use a VBA macro to iterate through the tables and cells and round the numbers up. The following code should do roughly what you want I think, but it might need some tweaking. You can create a new macro by pressing Alt + F8, giving it the name RoundAllNumbersInTables then clicking Create.

Sub RoundAllNumbersInTables() Dim currentTbl As Table Dim currentCl As Cell Dim currentRow As Row Dim currentText As String For Each currentTbl In ActiveDocument.Tables For Each currentRow In currentTbl.Rows For Each currentCl In currentRow.Cells currentText = Trim(Left(currentCl.Range.Text, Len(currentCl.Range.Text) - 2)) If IsNumeric(currentText) Then currentCl.Range.Text = Format(Round(currentText, 3), "0.###") End If Next Next Next
End Sub

Obviously though you have to be careful that this doesn't mess something up, so it's best to have a backup of your file.

Overall I would say it would be better to use Excel instead for this kind of thing if possible as it is much better suited to it.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy