Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TAdvSpreadGrid
How to use the lookup function

LOOKUP(param; range1, range2) : returns the value of the element in range2 that has the index of the matching element in range1 for param

Example:

This code snippet shows how the lookup is performed for the value of 2 in range A1:A5 and the value is retrieved from range B1:B5
begin
  advspreadGrid1.Cells[1,1] := '1';
  advspreadGrid1.Cells[1,2] := '2';
  advspreadGrid1.Cells[1,3] := '3';
  advspreadGrid1.Cells[1,4] := '4';
  advspreadGrid1.Cells[1,5] := '5';

  advspreadGrid1.Cells[2,1] := 'BMW';
  advspreadGrid1.Cells[2,2] := 'Audi';
  advspreadGrid1.Cells[2,3] := 'Ferrari';
  advspreadGrid1.Cells[2,4] := 'Mercedes';
  advspreadGrid1.Cells[2,5] := 'Porsche';

  advspreadGrid1.Cells[3,1] := '=LOOKUP("2";A1:A5;B1:B5)';
  advspreadgrid1.Recalc;
end;