LOOKUP

Look for criterion in an already-sorted array, and return a corresponding result. Returns the contents of a cell either from a one-row or one-column range.

Optionally, the assigned value (of the same index) is returned in a different column and row. As opposed to VLOOKUP and HLOOKUP, search and result vector may be at different positions; they do not have to be adjacent.

note

Die Suche unterstützt Platzhalter oder reguläre Ausdrücke. Wenn reguläre Ausdrücke aktiviert sind, können Sie "all.*" eingeben, um beispielsweise das erste Vorkommen von "all", gefolgt von beliebigen Zeichen, zu finden. Wenn Sie nach einem Text suchen möchten, der auch ein regulärer Ausdruck ist, müssen Sie entweder jedem Metazeichen oder Operator eines regulären Ausdrucks ein "\" voranstellen oder den Text in \Q…\E einschließen. Die automatische Auswertung von Platzhaltern oder regulären Ausdrücken können Sie unter – LibreOfficeDev Calc – Berechnen umschalten.


warning

Wenn Sie Funktionen verwenden, bei denen ein oder mehrere Argumente Suchkriterien-Zeichenfolgen sind, die einen regulären Ausdruck darstellen, besteht der erste Versuch darin, die Zeichenfolgen-Kriterien in Zahlen umzuwandeln. Zum Beispiel wird in bestimmten Gebietsschemen ".0" in "0.0" konvertiert und so weiter. Bei Erfolg handelt es sich bei der Übereinstimmung nicht um eine Übereinstimmung mit regulären Ausdrücken, sondern um eine numerische Übereinstimmung. Wenn Sie jedoch zu einem Gebietsschema wechseln, in dem das Dezimaltrennzeichen nicht der Punkt ist, funktioniert die Konvertierung regulärer Ausdrücke. Um die Auswertung des regulären Ausdrucks anstelle eines numerischen Ausdrucks zu erzwingen, verwenden Sie einen Ausdruck, der nicht als numerisch falsch verstanden werden kann, beispielsweise ".[0]" oder ".\0" oder "(?i).0".


Syntax

LOOKUP(Lookup; SearchVector [; ResultVector])

Lookup is the value of any type to be looked for; entered either directly or as a reference.

SearchVector is an array of data. The lookup is performed in the first row or first column of the array.

note

The search vector for the LOOKUP must be sorted ascending, otherwise the search will not return any usable results. Numerical values precede values of type Text if both types are included (for example, -2, 0, 2, “A”, “B”).


If SearchVector has same number of columns and rows or has more rows than columns, LOOKUP searches in the first column (similar to VLOOKUP), and returns the corresponding value in the last column.

If SearchVector has more columns than rows, LOOKUP searches in the first row (similar to HLOOKUP), and returns the corresponding value in the last row.

ResultVector is another single-row or single-column range from which the result of the function is taken. The result is the cell of the result vector with the same index as the instance found in the search vector.

If ResultVector is omitted, the function returns the value found in the last row or last column of the SearchVector array.

If SearchVector is a one-dimensional array and if ResultVector is omitted, the function returns the last occurrence of the lookup value if it exists in the SearchVector.

Behandeln von leeren Zellen

Beispiel

The table below list the country codes of some countries.

Source: https://www.countrycode.org

Country Codes Samples

=LOOKUP(46,A2:B34) returns "Sweden", the country which code is 46. Since the result vector is not defined, the function returns the value in the last column of the search array.

=LOOKUP(55,A2:A34,D2:D34) returns "BR/BRA", the ISO code for country code 55 (Brazil).

=LOOKUP(7,A2:B34) returns "Russia", the last occurrence of country code 7 in the search array.

Technische Information

note

Diese Funktion ist Teil des Open-Document-Formats für Office-Anwendungen (OpenDocument) Standardversion 1.3.