很多时候,我需要在Word 文档(Word document)中包含一些简单的数据计算,而表格是最好的选择。您总是可以尝试将整个Excel 电子表格(Excel spreadsheet)插入您的Word 文档(Word doc)中,但有时这样做有点过头了。
在本文中,我将讨论如何在Word中的表格中使用公式。您可以使用的公式屈指可数,但足以获得总数、计数、整数等。此外,如果您已经熟悉Excel ,那么在(Excel)Word中使用公式将是小菜一碟。
将公式插入 Word 表格
让我们从创建一个简单的测试表(test table)开始。单击(Click)“插入(Insert)”选项卡,然后单击“表格(Table)” 。从网格中选择所需的行数和列数。
插入表格后,继续添加一些数据。我刚刚为我的示例制作了一个非常简单的表格,其中包含几个数字。
现在让我们继续插入一个公式。在第一个示例中,我将把第一行中的前三个值加在一起 (10 + 10 + 10)。为此,请在第四列的最后一个单元格内单击,单击功能区中的布局(Layout) ,然后单击最右侧的公式(Formula)。
这将打开公式对话框(Formula dialog),默认值为 = SUM(LEFT)。
如果您只是单击确定,您将在单元格 (30) 中看到我们正在寻找的值。
让我们谈谈公式。就像(Just)Excel一样,公式以等号开头,后跟函数名称和(function name and arguments)括号中的参数。在Excel 中(Excel),您只指定单元格引用或命名范围,如 A1、A1:A3 等,但在Word中,您可以使用这些位置术语。
在示例中,LEFT表示输入公式的单元格左侧的所有单元格。您也可以使用RIGHT、ABOVE和BELOW。您可以将这些位置参数与SUM、PRODUCT、MIN、MAX、COUNT 和 AVERAGE(COUNT and AVERAGE)一起使用。
此外,您可以组合使用这些参数。例如,我可以输入=SUM(LEFT, RIGHT),它将添加该单元格左侧和右侧(left and right)的所有单元格。=SUM(ABOVE, RIGHT)会将单元格上方和右侧的所有数字相加。你得到图片。
现在让我们谈谈其他一些函数以及我们如何以不同的方式指定单元格。如果我想在第一列中找到最大数字,我可以添加另一行,然后使用=MAX(ABOVE)函数得到 30。但是,还有另一种方法可以做到这一点。我也可以简单地进入任何单元格并输入(cell and type)= =MAX(A1:A3),它引用了第一列中的前三行。
这真的很方便,因为您可以将公式放在表格中您想要的任何位置。您还可以引用单个单元格,例如编写=SUM(A1, A2, A3),这将为您提供相同的结果。如果你写=SUM(A1:B3),它将添加 A1、A2、A3、B1、B2 和 B3。使用这些组合,您几乎可以引用任何您喜欢的数据。
如果您想查看可以在Word 公式(Word formula)中使用的所有函数的列表,只需单击“粘贴函数( Paste Function)”框。
您可以使用IF语句、AND和OR运算符等。让我们看一个更复杂的公式的例子。
在上面的例子中,我有 =IF( SUM (A1:A3) > 50, 50, 0),也就是说如果 A1 到 A3 的和大于 50,则显示 50,否则显示 0。值得注意的是所有这些功能实际上只适用于数字。你不能对文本或字符串(text or strings)做任何事情,你也不能输出任何文本或字符串(text or string)。一切都必须是一个数字。
这是另一个使用AND 函数(AND function)的示例。在这个例子中,我是说如果 A1 到 A3 的总和和最大值都大于 50,则为 true,否则为 false。True用 1 表示,False用 0 表示。
如果您输入公式并且其中有错误,您将看到语法错误消息(error message)。
要修复公式,只需右键单击错误并选择Edit Field。
这将打开字段(Field)对话框。在这里,您只需单击“公式(Formula)”按钮。
这将打开我们从一开始就使用的相同的公式编辑对话框。(Formula)这就是将公式插入Word的全部内容。您还可以查看Microsoft的(Microsoft)在线文档(online documentation),其中详细解释了每个功能。
总体而言,它甚至比不上Excel的强大功能,但对于Word中的一些基本电子表格计算来说已经足够了。如果您有任何问题,请随时发表评论。享受!
How to Create and Use Formulas in Tables in Word
There are a lot of timеs whеn I need to include some simple data calculations in a Word document and a tablе is the beѕt option. You can alwаys 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.
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.
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.
This will bring up the Formula dialog with a default of =SUM(LEFT).
If you were to simply click OK, you will see the value we are looking for in the cell (30).
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.
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.
You can use IF statements, AND and OR operators and more. Let’s see an example of a more complex formula.
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.
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.
To fix the formula, just right click on the error and choose Edit Field.
This will bring up the Field dialog. Here you just have to click on the Formula button.
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!