說明
Use this function to return a value or the reference to a value from within a table or range. Supported in Chains.
語法
INDEX(array, row_num, [column_num])
Inputs
This function accepts the following arguments:
名稱 | 必要 | 說明 | Valid input |
---|---|---|---|
陣列 |
是 | The range of cells or array constant to select from. | A range of cells or an array constant. |
row_num |
是 | The row number in the array from which to return a value. | A positive integer, or blank if column_num is provided. |
column_num |
選用 | The column number in the array from which to return a value. | A positive integer. Required if array has more than one column. |
範例
範例資料
A | B | C |
---|---|---|
Apple | Red | $0.50 |
Banana | Yellow | $0.30 |
Cherry | Red | $0.75 |
日期 | Brown | $0.60 |
Sample formulas
公式 | 說明 | 結果 |
---|---|---|
=INDEX(A1:C4,2,3) |
Returns the value in the 2nd row, 3rd column of the range A1:C4. | $ 0.30 |
=INDEX(A1:A4,3) |
Returns the value in the 3rd row of column A. | Cherry |
=INDEX(C1:C4, MATCH("Cherry",A1:A4,0)) |
Combines INDEX with MATCH to look up Cherry's price. | $ 0.75 |
=INDEX(A1:C4,0,2) |
Attempts to return an array of all values in the 2nd column. | #VALUE! |
附註
- If
row_num
orcolumn_num
is 0, INDEX returns an array of the entire row or column. - If
row_num
orcolumn_num
is out of bounds, INDEX returns a #REF! error. - If an INDEX is used for an array, it will return a #VALUE! error, because Workiva Spreadsheets do not support arrays.
- When using INDEX with a single column or single row, you can omit the
column_num
orrow_num
argument, respectively.
提示
- INDEX is often used in combination with MATCH for flexible lookup formulas. The page Using INDEX-MATCH to create flexible lookups provides an example.
- When working with large datasets, INDEX can be more efficient than VLOOKUP for multiple lookups.
- You can use INDEX to dynamically reference entire rows or columns by using "0" as the row or column argument.
- Combine INDEX with other functions such as SMALL or LARGE to find the nth largest or smallest value in a range.