If formulas in word tables

Testing whether conditions are true or false and making logical comparisons between expressions are common to many tasks. You can use the AND, OR, NOT, and IF functions to create conditional formulas.

For example, the IF function uses the following arguments.

formula with the if function

Formula that uses the IF function

Button image  logical_test: The condition that you want to check.

Callout 2  value_if_true: The value to return if the condition is True.

Button image  value_if_false: The value to return if the condition is False.

For more information about how to create formulas, see Create or delete a formula.

What do you want to do?

  • Create a conditional formula that results in a logical value (TRUE or FALSE)

  • Create a conditional formula that results in another calculation or in values other than TRUE or FALSE

Create a conditional formula that results in a logical value (TRUE or FALSE)

To do this task, use the AND, OR, and NOT functions and operators as shown in the following example.

Example

The example may be easier to understand if you copy it to a blank worksheet.

How do I copy an example?

  1. Select the example in this article.

    selecting an example from help in Excel 2013 for Windows

    Selecting an example from Help

  2. Press CTRL+C.

  3. In Excel, create a blank workbook or worksheet.

  4. In the worksheet, select cell A1, and press CTRL+V.

Important: For the example to work properly, you must paste it into cell A1 of the worksheet.

  1. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.

After you copy the example to a blank worksheet, you can adapt it to suit your needs.

Data

15

9

8

Sprockets

Widgets

Formula

Description (Result)

=AND(A2>A3, A2<A4)

Determines if the value in cell A2 is greater than the value in A3 and also if the value in A2 is less than the value in A4. (FALSE)

=OR(A2>A3, A2<A4)

Determines if the value in cell A2 is greater than the value in A3 or if the value in A2 is less than the value in A4. (TRUE)

=NOT(A2+A3=24)

Determines if the sum of the values in cells A2 and A3 is not equal to 24. (FALSE)

=NOT(A5=»Sprockets»)

Determines if the value in cell A5 is not equal to «Sprockets.» (FALSE)

=OR(A5<>»Sprockets»,A6 = «Widgets»)

Determines if the value in cell A5 is not equal to «Sprockets» or if the value in A6 is equal to «Widgets.» (TRUE)

For more information about how to use these functions, see AND function, OR function, and NOT function.

Top of Page

Create a conditional formula that results in another calculation or in values other than TRUE or FALSE

To do this task, use the IF, AND, and OR functions and operators as shown in the following example.

Example

The example may be easier to understand if you copy it to a blank worksheet.

How do I copy an example?

  1. Select the example in this article.

    Important: Do not select the row or column headers.

    selecting an example from help in Excel 2013 for Windows

    Selecting an example from Help

  2. Press CTRL+C.

  3. In Excel, create a blank workbook or worksheet.

  4. In the worksheet, select cell A1, and press CTRL+V.

Important: For the example to work properly, you must paste it into cell A1 of the worksheet.

  1. To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Formulas tab, in the Formula Auditing group, click the Show Formulas button.

After you copy the example to a blank worksheet, you can adapt it to suit your needs.

Data

15

9

8

Sprockets

Widgets

Formula

Description (Result)

=IF(A2=15, «OK», «Not OK»)

If the value in cell A2 equals 15, return «OK.» Otherwise, return «Not OK.» (OK)

=IF(A2<>15, «OK», «Not OK»)

If the value in cell A2 is not equal to 15, return «OK.» Otherwise, return «Not OK.» (Not OK)

=IF(NOT(A2<=15), «OK», «Not OK»)

If the value in cell A2 is not less than or equal to 15, return «OK.» Otherwise, return «Not OK.» (Not OK)

=IF(A5<>»SPROCKETS», «OK», «Not OK»)

If the value in cell A5 is not equal to «SPROCKETS», return «OK.» Otherwise, return «Not OK.» (Not OK)

=IF(AND(A2>A3, A2<A4), «OK», «Not OK»)

If the value in cell A2 is greater than the value in A3 and the value in A2 is also less than the value in A4, return «OK.» Otherwise, return «Not OK.» (Not OK)

=IF(AND(A2<>A3, A2<>A4), «OK», «Not OK»)

If the value in cell A2 is not equal to A3 and the value in A2 is also not equal to the value in A4, return «OK.» Otherwise, return «Not OK.» (OK)

=IF(OR(A2>A3, A2<A4), «OK», «Not OK»)

If the value in cell A2 is greater than the value in A3 or the value in A2 is less than the value in A4, return «OK.» Otherwise, return «Not OK.» (OK)

=IF(OR(A5<>»Sprockets», A6<>»Widgets»), «OK», «Not OK»)

If the value in cell A5 is not equal to «Sprockets» or the value in A6 is not equal to «Widgets», return «OK.» Otherwise, return «Not OK.» (Not OK)

=IF(OR(A2<>A3, A2<>A4), «OK», «Not OK»)

If the value in cell A2 is not equal to the value in A3 or the value in A2 is not equal to the value in A4, return «OK.» Otherwise, return «Not OK.» (OK)

For more information about how to use these functions, see IF function, AND function, and OR function.

Top of Page

Guest


  • #1

I’m trying to insert the equivalent of Excel: =IF(B5<=9,»10
days»,IF(B5<=19,»15 days»,»20 days»)) into a word table, where b5 is the
table reference containing a sum field. I’ve had a variety of responses,
none of which is correct. Any suggestions?

Advertisements

macropod


  • #2

Hi Linda,

When you’re using text in a formula in Word, you need a completely different
syntax from what you’d use in Excel.

There are two solutions to your problem, one that allows you to use an Excel
syntax, by not having «days» in the formula itself, and the other that does:

First solution. Construct your formula as-
{=IF(B5<=19,15,20)} days

Second solution. Construct your formula as-
{IF{=B5}<= 19 «15 days» «20 days»}

In both formulae, the ‘{}] are the field braces created via CTRL-F9.

Cheers

Guest


  • #3

Thanks for this, but I’m still having a problem. I need to nest the IF
formulae so that if b5 = less than 9 enter 10 days, if 10 to 19 enter 15
days, if 20+ enter 20 days. It’s this nesting that’s really messing me up.

cheers
Linda

macropod said:

Hi Linda,

When you’re using text in a formula in Word, you need a completely different
syntax from what you’d use in Excel.

There are two solutions to your problem, one that allows you to use an Excel
syntax, by not having «days» in the formula itself, and the other that does:

First solution. Construct your formula as-
{=IF(B5<=19,15,20)} days

Second solution. Construct your formula as-
{IF{=B5}<= 19 «15 days» «20 days»}

In both formulae, the ‘{}] are the field braces created via CTRL-F9.

Cheers

LindaM said:

I’m trying to insert the equivalent of Excel: =IF(B5<=9,»10
days»,IF(B5<=19,»15 days»,»20 days»)) into a word table, where b5 is the
table reference containing a sum field. I’ve had a variety of responses,
none of which is correct. Any suggestions?

macropod


  • #4

Hi Linda,

In that case, you could use:
{=IF(B5<10,10,IF(B5<20,15,20))} days
or
{IF{=B5}< 10 «10 days» {IF{=B5}< 20 «15 days» «20 days»}}

Cheers

LindaM said:

Thanks for this, but I’m still having a problem. I need to nest the IF
formulae so that if b5 = less than 9 enter 10 days, if 10 to 19 enter 15
days, if 20+ enter 20 days. It’s this nesting that’s really messing me up.

cheers
Linda

macropod said:

Hi Linda,

When you’re using text in a formula in Word, you need a completely different
syntax from what you’d use in Excel.

There are two solutions to your problem, one that allows you to use an Excel
syntax, by not having «days» in the formula itself, and the other that does:

First solution. Construct your formula as-
{=IF(B5<=19,15,20)} days

Second solution. Construct your formula as-
{IF{=B5}<= 19 «15 days» «20 days»}

In both formulae, the ‘{}] are the field braces created via CTRL-F9.

Cheers

LindaM said:

I’m trying to insert the equivalent of Excel: =IF(B5<=9,»10
days»,IF(B5<=19,»15 days»,»20 days»)) into a word table, where b5 is the
table reference containing a sum field. I’ve had a variety of responses,
none of which is correct. Any suggestions?

Guest


  • #5

Hey it works! Thanks for your time and expertise.

macropod said:

Hi Linda,

In that case, you could use:
{=IF(B5<10,10,IF(B5<20,15,20))} days
or
{IF{=B5}< 10 «10 days» {IF{=B5}< 20 «15 days» «20 days»}}

Cheers

LindaM said:

Thanks for this, but I’m still having a problem. I need to nest the IF
formulae so that if b5 = less than 9 enter 10 days, if 10 to 19 enter 15
days, if 20+ enter 20 days. It’s this nesting that’s really messing me up.

cheers
Linda

macropod said:

Hi Linda,

When you’re using text in a formula in Word, you need a completely different
syntax from what you’d use in Excel.

There are two solutions to your problem, one that allows you to use an Excel
syntax, by not having «days» in the formula itself, and the other that does:

First solution. Construct your formula as-
{=IF(B5<=19,15,20)} days

Second solution. Construct your formula as-
{IF{=B5}<= 19 «15 days» «20 days»}

In both formulae, the ‘{}] are the field braces created via CTRL-F9.

Cheers

I’m trying to insert the equivalent of Excel: =IF(B5<=9,»10
days»,IF(B5<=19,»15 days»,»20 days»)) into a word table, where b5 is the
table reference containing a sum field. I’ve had a variety of responses,
none of which is correct. Any suggestions?

Advertisements

  • #6

Hi Macropod,

I’ve read your solution and i tried to write my formula as you suggest, but i think the situation is different.
I have a table in which instead of «0» i got «-» (dashes).

I would like to make a Delta column and i have to deduct two cells. One of this contains «-» the dash and the other one a value.

I wrote the formula as:

{IF{=B5-C5}= 0 «-» {=B5-C5}}

but i receive a Syntax Error from Word…
Could you help me on this?

best regards,
Riccardo Nicolai

Hi Linda,

In that case, you could use:
{=IF(B5<10,10,IF(B5<20,15,20))} days
or
{IF{=B5}< 10 «10 days» {IF{=B5}< 20 «15 days» «20 days»}}

Cheers

«LindaM» <(e-mail address removed)> wrote in message
news:(e-mail address removed)…
> Thanks for this, but I’m still having a problem. I need to nest the IF
> formulae so that if b5 = less than 9 enter 10 days, if 10 to 19 enter 15
> days, if 20+ enter 20 days. It’s this nesting that’s really messing me up.
>
> cheers
> Linda
>
> «macropod» wrote:
>
> > Hi Linda,

> >
> > When you’re using text in a formula in Word, you need a completely
different
> > syntax from what you’d use in Excel.
> >
> > There are two solutions to your problem, one that allows you to use an
Excel
> > syntax, by not having «days» in the formula itself, and the other that
does:
> >
> > First solution. Construct your formula as-
> > {=IF(B5<=19,15,20)} days
> >
> > Second solution. Construct your formula as-
> > {IF{=B5}<= 19 «15 days» «20 days»}
> >
> > In both formulae, the ‘{}] are the field braces created via CTRL-F9.
> >
> > Cheers
> >
> > «LindaM» <(e-mail address removed)> wrote in message
> > news:(e-mail address removed)…
> > > I’m trying to insert the equivalent of Excel: =IF(B5<=9,»10
> > > days»,IF(B5<=19,»15 days»,»20 days»)) into a word table, where b5 is
the
> > > table reference containing a sum field. I’ve had a variety of
responses,
> > > none of which is correct. Any suggestions?
> > > —
> > > Linda M
> >
> >
> > —
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.778 / Virus Database: 525 — Release Date: 15/10/2004
> >
> >
> >

Last edited by a moderator: Jul 8, 2015

Advertisements

Create Calculations in Word Tables Using Formulas

by Avantix Learning Team | Updated October 9, 2021

Applies to: Microsoft® Word® 2013, 2016, 2019 or 365 (Windows)

You can insert formulas in Word tables to perform calculations. These formulas can include functions such as SUM or AVERAGE or basic operators. When you insert formulas in Word tables, you are really inserting fields so the fields will need to be updated if the data in the table changes. For more complex calculations, it’s usually best to create formulas in Excel where they will update automatically.

Formulas and functions in Word tables only work with numbers. You can’t perform text calculations or output text.

Recommended article: 3 Simple Ways to Copy or Import Excel Data into Word (Linked or Unlinked)

Note: Buttons and Ribbon tabs may display in a different way (with or without text) depending on your version of Word, the size of your screen and your Control Panel settings. For Word 365 users, Ribbon tabs may appear with different names. For example, the Table Tools Design tab may appear as Table Design.

To insert a formula in a cell in a Word table, you’ll need to use the Function command on the Table Tools Layout or Table Layout tab in the Ribbon:

Formulas command on the Ribbon in Word to insert formulas into Word tables.

Do you want to learn more about Microsoft Word? Check out our virtual classroom or live classroom Word courses >

Understanding formula syntax

When you insert a table in Word, each column and row are identified like cells in Excel worksheets and each cell is assigned a cell reference. In a Word table, the first column would be column A and the first row would be row 1 so the first cell would be identified as A1. Therefore, you can create calculations that refer to cells (such as =A1+A2).

In Word and Excel, you can use the same basic operators:

  • addition (+)
  • subtraction (-)
  • multiplication (*)
  • division (/)

Typically, formulas in Word tables are created using common functions such as SUM, AVERAGE, MIN, MAX or COUNT and refer to a range. They must start with an equal sign (=).

You can refer to ranges of cells using ABOVE, LEFT, RIGHT or BELOW as the arguments for functions. If you’re trying to sum the cells at the bottom of a column, the formula would be =SUM(ABOVE). You can also combine these arguments. For example, you could enter a formula =SUM(ABOVE,LEFT) and it would sum all cells that are above and to the left of that cell. Functions can also refer to cell references such as =SUM(C1:C10). You can also refer to individual cells such =SUM(B1,C1,D5).

Word tables can also perform more complex calculations using the IF function with the syntax =IF(test,true,false). For example, =IF(A5>=1000,0,50) could be used to calculate a shipping cost of 50 if orders are less than 1000. You can also use the AND and OR functions with the IF function.

Inserting a formula in a table

To insert a formula in a table:

  1. Click in the cell where you want to enter a formula.
  2. Click the Table Tools Layout or Table Layout tab in the Ribbon.
  3. Select Function (fx) in the Data group. A dialog box appears. Word will typically insert a function and arguments in the Formula box.
  4. If you want to accept the suggested formula, click OK. If you want to change the formula, click in the Formula box and enter a formula (starting with =). You can also choose other functions from the Paste Function drop-down menu.
  5. If necessary, select a format from the Format drop-down menu.
  6. Click OK. Word inserts the formula as a field and displays the results.

The Function dialog box appears as follows with a formula and a format selected:

Function dialog box in Word to insert function in a Word table.

Updating a formula

If the original data changes, you can right-click the Formula field and select Update from the drop-down menu or press F9. If you want to update all formulas in a table, select all of the cells in the table and press F9. To select the entire table, click the four arrows on the top left of the table.

Changing a formula

To change a formula in a table:

  1. Right-click the formula or error. A drop-down menu appears.
  2. Select Edit field.
  3. Make the desired changes.
  4. Click OK.

Updating all fields

To update all fields in all tables:

  1. Press Ctrl + A to select all.
  2. Press F9.

Formula fields are just one type of field you can use in Word. There are many other fields that can insert variable information in Word documents.

Subscribe to get more articles like this one

Did you find this article helpful? If you would like to receive new articles, join our email list.

More resources

4 Ways to Create a Table in Word

How to Insert Fields in Word (Built-in or Custom)

5 Ways to Insert the Division Symbol in Word (Type or Insert ÷)

How to Insert Reusable Text Snippets in Word with Quick Parts

10 Microsoft Word Tips, Tricks and Shortcuts for Selecting in Tables

Related courses

Microsoft Word: Intermediate / Advanced

Microsoft Excel: Intermediate / Advanced

Microsoft PowerPoint: Intermediate / Advanced

Microsoft Word: Long Documents Master Class

Microsoft Word: Styles, Templates and Tables of Contents

Microsoft Word: Designing Dynamic Word Documents Using Fields

VIEW MORE COURSES >

Our instructor-led courses are delivered in virtual classroom format or at our downtown Toronto location at 18 King Street East, Suite 1400, Toronto, Ontario, Canada (some in-person classroom courses may also be delivered at an alternate downtown Toronto location). Contact us at info@avantixlearning.ca if you’d like to arrange custom instructor-led virtual classroom or onsite training on a date that’s convenient for you.

Copyright 2023 Avantix® Learning

Microsoft, the Microsoft logo, Microsoft Office and related Microsoft applications and logos are registered trademarks of Microsoft Corporation in Canada, US and other countries. All other trademarks are the property of the registered owners.

Avantix Learning |18 King Street East, Suite 1400, Toronto, Ontario, Canada M5C 1C4 | Contact us at info@avantixlearning.ca

Word provides some simple formulas and functions without need to embed Excel tables. It is easy
to insert and use formulas:

  • In a Word
    table:

    Formulas in a table Word 365

  • In a document body:

    The first example of the formula in Word 365

You can use simple formulas in Microsoft Word, such as addition (+), subtraction (-),
multiplication (*), or division (/). Also, you can calculate a power of (^):

Example of cell addresses in Word 365

See
How to reference a cell of a Word table
for more details.

All functions you can see in the Paste function drop-down list of the
Formula dialog box:

Functions in Formula dialog box Word 365

Function Description
ABS () Calculates the absolute value of the value inside the parentheses.
AND () Evaluates whether the arguments inside the parentheses are all TRUE.
AVERAGE () Calculates the average of the elements identified inside the parentheses.
COUNT () Calculates the number of elements identified inside the parentheses.
DEFINED () Evaluates whether the argument inside parentheses is defined. Returns 1 if the
argument has been defined and evaluates without error, 0 if the argument has not
been defined or returns an error.
FALSE Always returns 0
IF () Evaluates the first argument. Returns the second argument if the first argument is true;
returns the third argument if the first argument is false.

Note: Requires exactly three arguments.

INT () Rounds the value inside the parentheses down to the nearest integer.
MAX () Returns the maximum value of the items identified inside the parentheses.
MIN () Returns the minimum value of the items identified inside the parentheses.
MOD () Takes two arguments (must be numbers or evaluate to numbers). Returns the remainder after
the second argument is divided by the first. If the remainder is 0 (zero), returns
0.0.
NOT Evaluates whether the argument is true. Returns 0 if the argument is true, 1 if
the argument is false. Mostly used inside an IF formula.
OR () Takes two arguments. If both are false, returns 0, else returns 1. Mostly used
inside an IF formula.
PRODUCT () Calculates the product of items identified inside the parentheses.
ROUND () Rounds the first argument to the number of digits specified by the second argument. If the
second argument is greater than zero (0), first argument is rounded down to the
specified number of digits. If second argument is zero (0), first argument is rounded
down to the nearest integer. If second argument is negative, first argument is rounded down to
the left of the decimal.
SIGN () Takes one argument that must either be a number or evaluate to a number. Evaluates
whether the item identified inside the parentheses if greater than, equal to, or less
than zero (0). Returns 1 if greater than zero, 0 if zero, -1
if less than zero.
SUM () Calculates the sum of items identified inside the parentheses.
TRUE Always returns 1.

The arguments can be:

Argument Description
ABOVE Cells above the current. For example, = SUM(ABOVE)
BELOW Cells below the current. For example, = SUM(BELOW)
LEFT Cells on left of the current. For example, = SUM(LEFT)
RIGHT Cells on right of the current. For example, = SUM(RIGHT)

See also this tip in French:
Fonctions et formules dans Word.

Please, disable AdBlock and reload the page to continue

Today, 30% of our visitors use Ad-Block to block ads.We understand your pain with ads, but without ads, we won’t be able to provide you with free content soon. If you need our content for work or study, please support our efforts and disable AdBlock for our site. As you will see, we have a lot of helpful information to share.

There are a lot of times when I need to include some simple data calculations in a Word document and a table is the best option. You can always try to insert an entire Excel spreadsheet into your Word doc, but that’s overkill sometimes.

In this article, I’m going to talk about how you can use formulas inside tables in Word. There are only a handful of formulas you can use, but it’s enough to get totals, counts, round numbers, etc. Also, if you are already familiar with Excel, then using the formulas in Word will be a piece of cake.

Insert Formulas into Word Tables

Let’s start out by creating a simple test table. Click on the Insert tab and then click on Table. Choose how many rows and columns you want from the grid.

insert table word

Once your table has been inserted, go ahead and add in some data. I’ve just made a really simple table with a couple of numbers for my example.

word table example

Now let’s go ahead and insert a formula. In the first example, I’m going to add the first three values in the first row together (10 + 10 + 10). To do this, click inside the last cell in the fourth column, click on Layout in the ribbon and then click on Formula at the far right.

insert word formula

This will bring up the Formula dialog with a default of =SUM(LEFT).

add formula word

If you were to simply click OK, you will see the value we are looking for in the cell (30).

added sum word

Let’s talk about the formula. Just like Excel, a formula starts with an equals sign, followed by a function name and arguments in parenthesis. In Excel, you only specify cell references or named ranges like A1, A1:A3, etc., but in Word, you have these positional terms you can use.

In the example, LEFT means all cells that are to the left of the cell in which the formula is entered. You can also use RIGHT, ABOVE and BELOW. You can use these positional arguments with SUM, PRODUCT, MIN, MAX, COUNT and AVERAGE.

In addition, you can use these arguments in combination. For example, I could type in =SUM(LEFT, RIGHT) and it would add all the cells that are to the left and right of that cell. =SUM(ABOVE, RIGHT) would add all numbers that are above the cell and to the right. You get the picture.

Now let’s talk about some of the other functions and how we can specify cells in a different manner. If I wanted to find the maximum number in the first column, I could add another row and then use the =MAX(ABOVE) function to get 30. However, there is another way you can do this. I could also simply go into any cell and type in =MAX(A1:A3), which references the first three rows in the first column.

cell reference word

This is really convenient because you can put the formulas anywhere you want in the table. You can also reference individual cells like writing =SUM(A1, A2, A3), which will give you the same result. If you write =SUM(A1:B3), it will add A1, A2, A3, B1, B2, and B3. Using these combinations, you can pretty much reference any data you like.

If you want to see a list of all the functions you can use in your Word formula, just click on the Paste Function box.

paste function word

You can use IF statements, AND and OR operators and more. Let’s see an example of a more complex formula.

if statement word

In the example above, I have =IF(SUM(A1:A3) > 50, 50, 0), which means that if the sum from A1 to A3 is greater than 50, show 50, otherwise show 0. It’s worth noting that all of these functions really only work with numbers. You can’t do anything with text or strings and you can’t output any text or string either. Everything has to be a number.

and statement word

Here’s another example using the AND function. In this example, I am saying that if both the sum and max value of A1 to A3 is greater than 50, then true otherwise false. True is represented by a 1 and False by 0.

If you type in a formula and it’s got an error in it, you’ll see a syntax error message.

syntax error word

To fix the formula, just right click on the error and choose Edit Field.

edit field

This will bring up the Field dialog. Here you just have to click on the Formula button.

edit formula

This will bring up the same Formula editing dialog that we’ve been working with since the beginning. That’s about all there is to inserting formulas into Word. You can also check out the online documentation from Microsoft that explains each function in detail.

Overall, it’s nothing even close to the power of Excel, but it’s enough for some basic spreadsheet calculations right inside Word. If you have any questions, feel free to comment. Enjoy!

Понравилась статья? Поделить с друзьями:
  • If formula with color in excel
  • If and or functions in excel 2007
  • If and or function in excel with example
  • If formula in excel with range
  • If and or formula in excel with example