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

Η αναζήτηση υποστηρίζει χαρακτήρες Υποκατάστασης (μπαλαντέρ) ή κανονικές εκφράσεις. Με ενεργοποιημένες τις κανονικές εκφράσεις, μπορείτε να εισαγάγετε "all.*", για παράδειγμα, για να βρείτε την πρώτη θέση του "all" ακολουθούμενη από οποιουσδήποτε χαρακτήρες. Εάν θέλετε να αναζητήσετε ένα κείμενο που είναι επίσης κανονική έκφραση, πρέπει είτε να προηγηθεί κάθε μεταχαρακτήρα ή τελεστή κανονικής έκφρασης με έναν χαρακτήρα "\" ή να περικλείσετε το κείμενο στο \Q...\E. Μπορείτε να ενεργοποιήσετε και να απενεργοποιήσετε την αυτόματη αξιολόγηση χαρακτήρων υποκατάστασης ή κανονικής έκφρασης στο - LibreOfficeDev Υπολογισμός - Υπολογισμός .


warning

Όταν χρησιμοποιείτε συναρτήσεις όπου ένα ή περισσότερα ορίσματα είναι συμβολοσειρές κριτηρίων αναζήτησης που αντιπροσωπεύουν κανονική έκφραση, η πρώτη προσπάθεια είναι η μετατροπή των κριτηρίων συμβολοσειρών σε αριθμούς. Παραδείγματος χάρη, το ".0" θα μετατραπεί σε 0.0 κ.ο.κ. Εάν είναι πετυχημένο, η συμφωνία δεν θα είναι συμφωνία κανονικής έκφρασης, αλλά αριθμητική συμφωνία. Όμως, όταν αλλάζετε στις τοπικές ρυθμίσεις όπου ο δεκαδικός διαχωριστής δεν είναι η τελεία, η μετατροπή της κανονικής έκφρασης λειτουργεί. Για να εξαναγκάσετε την αξιολόγηση της κανονικής έκφρασης αντί για την αριθμητική έκφραση, χρησιμοποιήστε κάποια έκφραση που δεν μπορεί να παρανοηθεί ως αριθμητική, όπως ".[0]", ή ".\0", ή "(?i).0".


Σύνταξη

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.

Διαχείριση κενών κελιών

Παράδειγμα

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.

Τεχνικές πληροφορίες

note

Αυτή η λειτουργία είναι μέρος του the Open Document Format για εφαρμογές γραφείου (OpenDocument) έκδοσης 1.3.