地址和引用,绝对和相对

Cell references

An individual cell is fully identified by the sheet it belongs, the column identifier (letter) located along the top of the columns and a row identifier (number) found along the left-hand side of the spreadsheet. On spreadsheets read from left to right, the complete reference for the upper left cell of the sheet is Sheet.A1.

Cell ranges

You can reference a set of cells by referencing them in ranges. Ranges can be a block of cells, entire set of columns and entire set of rows. The range A1:B2 is the first four cells in the upper left corner of the sheet. Range A:E contains all the cells of column A, B, C, D and E. Range 2:5 contains all the cells of row 2, 3, 4 and 5.

The reference to a cell of another document contains the fully qualified name of the other document between single quotes ('), then a hash #, then the name of the sheet of the other document, followed by a period and the name or reference of the cell.

For example, .

note

The path and document name URI must always be enclosed in single quotes. If the name contains single quotes (') they must be escaped using two single quotes (''). Only a sheet name may not be quoted if it does not contain a space or a character that would be an operator or the name would be pure numeric (for example, '123' must be quoted).


引用运算符

这些运算符返回 0、1 或更多个单元格区域。

区域具有最高优先级,然后是交集,最后是并集。

运算符

名称

Example

:

区域

A1:C108, A:D or 3:13

!

交集

SUM(A1:B6!B5:C12)

计算交集中所有单元格的和。此例中,计算单元格 B5 和 B6 的和。

~

连接或并集

Takes two references and returns a reference list, which is a concatenation of the left reference followed by the right reference. Double entries are referenced twice.

=COUNT(A1:B2~B2:C3) counts values of A1:B2 and B2:C3. Note that the cell B2 is counted twice.

=INDEX(A1:B2~C1:D2;2;1;2) selects cell C2, that is, the first cell of the second row, first column, of the second range (C1:D2) of the range list.


note

A reference list is not allowed inside an array expression.


相对地址

A1表示的是位于列A行1处的单元格。要描述一个单元格区域,只要在给出这个单元格区域左上角处的单元格位置后输入双引号,随后给出这个单元格区域右下角处的单元格位置即可。比如: 由工作表左上角处的四个单元格所组成的单元格区域可以命名为A1:B2。

这种描述单元格区域的方式(A1:B2)是一个相对引用。在复制公式时,您必须对借助相对引用描述的单元格区域重新进行配置。

绝对地址

与相对引用相反,绝对引用上述单元格区域的表达方式是:「$A$1:$B$2」。也就是说在每个单元格坐标说明之前需插入一个美元符号。

tip

LibreOffice can convert the current reference, in which the cursor is positioned in the input line, from relative to absolute and vice versa by pressing F4. If you start with a relative address such as A1, the first time you press this key combination, both row and column are set to absolute references ($A$1). The second time, only the row (A$1), and the third time, only the column ($A1). If you press the key combination once more, both column and row references are switched back to relative (A1)


LibreOffice Calc 还能够高亮显示对公式中数据的引用。比如按击单元格中的公式「=SUM(A1:C5;D15:D24)」后,工作表中这两个被引用的区域就会用颜色高亮显示。公式中的「A1:C5」部分显示为蓝色,工作表中的这个区域也以蓝色框表示;公式中的「D15:D24」显示为红色,相应地工作表中的这个区域则以红色框表示。

什么时候使用相对引用,什么时候使用绝对引用?

相对引用有什么不同呢?假设您想在单元格 E1 中计算 A1:B2 区域中的单元格总和。输入 E1 的公式为: =SUM(A1:B2)。如果后来您又决定在 A 列前插入一个新列,要添加的元素在 B1:C2 中,公式在 F1 中,而不是在 E1 中。插入新列之后,您必须检查和更正该工作表或其他工作表中的所有公式。

幸运的是,LibreOffice 会替您完成此任务。插入新列 A 后,公式 =SUM(A1:B2) 将自动更新为 =SUM(B1:C2)。插入新行 1 时,行号也会自动调整。只要移动了引用区域,LibreOffice Calc 中的绝对引用和相对引用就会进行相应的调整。但是请注意,复制公式时只调整相对引用,而不会调整绝对引用。

当要引用工作表中的某一个单元格进行计算时,请使用绝对引用。如果您没有将单元格设定为绝对引用,那么,当将引用了此单元格的公式复制到源单元格下方的单元格中时,引用的单元格也将跟着下移。

除了插入新的行或列,将引用了特定单元格的现有公式复制到同一工作表的另一个区域中时,也会更改引用的单元格。假定您在第 10 行中输入了公式 =SUM(A1:A9)。如果要计算右边相邻列的总和,只需将此公式复制到右边的单元格中。复制到列 B 中的公式将自动改为 =SUM(B1:B9)。

请支持我们!