INDEX

function INDEX(
  arg1: ApiRange = null,
  arg2: number = null,
  arg3: number = null,
  arg4: any = null,
): number | string | boolean

Description

Returns a value or reference of the cell at the intersection of a particular row and column, in a given range.

Parameters

arg1ApiRangedefault: null

Is a range of cells or an array constant..

arg2numberdefault: null

Selects the row in Array or Reference from which to return a value. If omitted, Column_num is required.

arg3numberdefault: null

Selects the column in Array or Reference from which to return a value. If omitted, Row_num is required.

arg4anydefault: null

Is a reference to one or more cell ranges.

Returns

number | string | boolean

Try It

var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
var ids = ["ID", 1, 2, 3, 4, 5];
var clients = ["Client", "John Smith", "Ella Tompson", "Mary Shinoda", "Lily-Ann Bates", "Clara Ray"];
var phones = ["Phone number", "12054097166", "13343943678", "12568542099", "12057032298", "12052914781"];

for (var i = 0; i < ids.length; i++) {
   oWorksheet.GetRange("A" + (i + 1)).SetValue(ids[i]);
}
for (var j = 0; j < clients.length; j++) {
   oWorksheet.GetRange("B" + (j + 1)).SetValue(clients[j]);
}
for (var n = 0; n < phones.length; n++) {
   oWorksheet.GetRange("C" + (n + 1)).SetValue(phones[n]);
}

var oRange = oWorksheet.GetRange("A1:C5");
oWorksheet.GetRange("E2").SetValue(oFunction.INDEX(oRange, 3, 2));

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).