Microsoft KB Archive/58480

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Setting Up a Table as a Spreadsheet in Word for Windows

PSS ID Number: Q58480 Article last modified on 02-04-1993

1.00 1.10 1.10a 2.00 2.00a 2.00a-CD 2.00b 2.00c WINDOWS

The information in this article applies to:
- Microsoft Word for Windows versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, and 2.0c - Microsoft Windows operating system versions 3.0 and 3.1

Summary: Microsoft Word for Windows allows the creation of simple spreadsheets using the Expression (=) field type. Individual cells are referenced by row and column number in the form of [RnCn], where R represents row, C represents column, and n represents the actual position starting from the upper-left cell. For example, [R1C2] refers to the cell located in the first row in the second column. An entire row may be referenced by Rn without a column reference. For example, [R1] represents row 1. Columns are referenced in a similar manner. Below is an example of a simple Word for Windows spreadsheet with information entered and field codes displayed: ————————————————————- | Item | Quantity | Price | Total Cost | ————————————————————- | item 1 | 4 | 3.00 |{=PRODUCT([r2c2:r2c3])#$0.00}| ————————————————————- | item 2 | 5 | 5.00 |{=PRODUCT([r3c2:r3c3])#$0.00}| ————————————————————- | totals | | |{=SUM([r2c4:r3c4])#$0.00} | ————————————————————- The preceding spreadsheet produces the following display with View Field Codes off or F9 pressed while the insertion point is in each =field: ———————————————————— | Item | Quantity | Price | Total Cost | ———————————————————— | item 1 | 4 | 3.00 | $12.00 | ———————————————————— | item 2 | 5 | 5.00 | $25.00 | ———————————————————— | totals | | | $37.00 | ————————————————————

More Information: To divide the contents of one cell in a table by another, use the following field code in [RnCn] representation. The following is an example: ————————————————————- | Item | Quantity | Price | Total Cost | ————————————————————- | item | 4 | 3.00 |{=sum([r2c3])/sum([r2c2])} | ————————————————————- This takes the contents of cell r2c3 and divides it by cell r2c2 and returns the following: ————————————————————- | Item | Quantity | Price | Total Cost | ————————————————————- | item | 4 | 3.00 | .75 | ————————————————————- In addition to the ([RnCn:RnCn]) format above, the same results can be obtained by the format ([RnCn],[RnCn]). The difference is that the first format represents a range of cells from RnCn through RnCn, while the second format represents two individual cells. For example, the first field statement {=PRODUCT([r2c2:r2c3])#$0.00} can also be stated as {=PRODUCT([r2c2],[r2c3])#$0.00}. In all cases, when referring to individual cells, columns, or rows, the actual cell reference(s) must be enclosed in brackets and those brackets must be enclosed in parentheses. Otherwise, updating the field results in either a syntax error or an unexpected end-of-expression error. Also, the cell must be referred to by a function such as PRODUCT() or SUM(). For example, {=([r2c2]+[r2c3])} does not work properly, although {=SUM([r2c2])+SUM([r2c3])} does work. Cells can be referenced to include themselves. For example, the field statement {=PRODUCT([r2])}, located in row 2, column 3 in the table above, will multiply the value of each cell in row 2 and place the result in the cell at row 2, column 3. If the F9 (update field) key is pressed again, the updated value will be used again and the new value will be stored back in row 2, column 3 (all without actually changing the data in columns 1 and 2 of that row). This could easily produce some misleading numbers.

Additional reference words: w4wfield 1.00 1.10 1.10a 2.00 2.00a 2.00a-CD 2.00b 2.00c ============================================================================= Copyright Microsoft Corporation 1993.