CERCA.VERT e CERCA.X: La Guida Definitiva

Tutto quello che avreste voluto sapere, spiegato in modo umano, con esempi veri, e senza farvi piangere davanti al foglio Excel.

Ogni anno, milioni di persone aprono Excel, guardano due tabelle separate, e pensano: “ci deve essere un modo per collegare queste cose senza copiarle a mano una per una.” C’è. Si chiama CERCA.VERT. E da qualche anno c’è anche CERCA.X, che è la stessa cosa ma senza i difetti imbarazzanti. Questa è la guida che nessuno vi ha mai fatto leggere prima di lasciarvi soli con un #N/D e un martedì pomeriggio distrutto.


CERCA.VERT: il classico che non passa mai di moda (ma che fa i capricci)

CERCA.VERT significa Cerca Verticalmente. In pratica: date un valore, vi va a cercarlo in una colonna di una tabella, e vi restituisce il valore corrispondente da un’altra colonna della stessa riga. Come un cameriere che cerca il vostro nome sulla lista prenotazioni e vi dice a che tavolo siete seduti.

Semplice in teoria. In pratica, come vedremo, quel cameriere a volte vi dice #N/D e sparisce in cucina.

La sintassi completa

CERCA.VERT(valore; matrice_tabella; indice_colonna; [corrisp_intervallo])
ParametroCosa faEsempio
valore – obbligatorioIl valore che volete cercare. Può essere un testo, un numero, o un riferimento a cella.A2 (la cella che contiene il codice dipendente)
matrice_tabella – obbligatorioLa tabella in cui cercare. Attenzione: la colonna di ricerca DEVE essere la prima colonna (quella più a sinistra) di questa selezione.B2:E500 oppure TabellaHR[#Tutto]
indice_colonna – obbligatorioIl numero della colonna della tabella da cui prendere il risultato. Se la tabella ha 4 colonne e volete la terza, scrivete 3.3 (restituisce il valore dalla 3ª colonna)
corrisp_intervallo facoltativoFALSO = cerca corrispondenza esatta (quasi sempre quello che volete). VERO = cerca corrispondenza approssimativa (utile per scaglioni, es. tasse, fasce di punteggio). Default: VERO, quindi scrivete sempre FALSO se non siete sicuri.FALSO

Trappola classica

Il parametro corrisp_intervallo ha default VERO. Questo significa che se ve lo dimenticate, Excel farà una ricerca approssimativa. Su dati non ordinati, questo produce risultati sbagliati senza avvisarvi. Senza errore. In silenzio. Come un collega che ha capito male le istruzioni ma non lo ammette.

Esempio base di CERCA.VERT

CERCA.VERT(A2; TabellaStipendi; 3; FALSO)
→ Cerca il codice in A2 nella prima colonna di TabellaStipendi, restituisce il valore dalla 3ª colonna

Pro Tip

Usate sempre i riferimenti di tabella strutturata (Tabella1[Colonna]) invece dei range rigidi (B2:E500). Se aggiungete righe alla tabella, la formula si aggiorna da sola. Se usate il range rigido, dovete ricordarvi di aggiornarlo manualmente, e sicuramente ve ne dimenticherete nel momento peggiore.


CERCA.X: il fratello minore che è cresciuto meglio

CERCA.X è arrivato nel 2019 con Microsoft 365 e ha risolto praticamente tutti i problemi strutturali di CERCA.VERT. Non è solo “un CERCA.VERT più nuovo” — è una funzione completamente ripensata che funziona in modo diverso, più flessibile e più umano.

Se CERCA.VERT è il cameriere che vi cerca sulla lista dal basso verso l’alto e può guardare solo a destra, CERCA.X è il maitre che può guardare ovunque, dirvi se non siete in lista senza fare scene, e persino cercare partendo dalla fine.

La sintassi completa

CERCA.X(valore; matrice_ricerca; matrice_restituzione; [se_non_trovato]; [modalità_corrispondenza]; [modalità_ricerca])
ParametroCosa faEsempio
valore obbligatorioIl valore che volete trovare. Identico a CERCA.VERT.A2
matrice_ricerca obbligatorioLa colonna (o riga) in cui cercare. Non deve essere per forza la prima. Può essere qualsiasi colonna della tabella.TabellaClienti[ID]
matrice_restituzione obbligatorioLa colonna (o riga) da cui prendere il risultato. Completamente separata dalla colonna di ricerca. Può essere a sinistra, a destra, ovunque.TabellaClienti[NomeCliente]
se_non_trovato facoltativoCosa restituire se il valore non viene trovato. Se omesso, restituisce #N/D. Con questo parametro, potete restituire testo personalizzato, zero, o qualsiasi altra cosa."Non trovato" oppure 0
modalità_corrispondenza facoltativo0 = corrispondenza esatta (default). -1 = esatta o prossimo minore. 1 = esatta o prossimo maggiore. 2 = con caratteri jolly (*, ?).0
modalità_ricerca facoltativo1 = dalla prima all’ultima riga (default). -1 = dall’ultima alla prima (utile se volete l’occorrenza più recente). 2 o -2 = ricerca binaria (su dati ordinati, molto più veloce).-1 (per trovare la riga più recente)

Pro Tip

Il parametro se_non_trovato da solo vale già il passaggio a CERCA.X. Il vecchio SE.ERRORE(CERCA.VERT(...); "Non trovato") è verbose e ripete la formula due volte. Con CERCA.X lo scrivete una volta sola, pulito, leggibile, e i vostri colleghi vi guarderanno con rispetto.

CERCA.X(A2; TabellaClienti[ID]; TabellaClienti[NomeCliente]; "Cliente non registrato")
→ Cerca A2 nella colonna ID, restituisce il NomeCliente. Se non esiste: "Cliente non registrato"

Quando usare uno e quando usare l’altro: 4 esempi reali

La risposta breve: usate sempre CERCA.X se il vostro Excel lo supporta. Ma la vita è complicata, i colleghi usano versioni vecchie di Office, e a volte esistono motivi legittimi per cui CERCA.VERT è ancora la scelta giusta. Eccoli.

CERCA.VERT · Limiti

  • La colonna di ricerca deve essere la prima (a sinistra)
  • Si riferisce alle colonne per numero, non per nome
  • Nessuna gestione nativa degli errori
  • Non cerca da destra verso sinistra
  • Non trova l’ultima occorrenza

CERCA.X · Vantaggi

  • Cerca in qualsiasi colonna, restituisce da qualsiasi colonna
  • Usa nomi di colonna, non numeri arbitrari
  • Gestione errori integrata con se_non_trovato
  • Cerca in entrambe le direzioni
  • Trova l’ultima occorrenza con modalità -1

Esempio 1 · Biblioteca · Vince CERCA.VERT
File condiviso con colleghi su Excel 2016

La bibliotecaria ha un catalogo con 8.000 libri: codice ISBN nella colonna A, titolo in B, autore in C, reparto in D. Deve fare un file che anche la collega part-time — che usa Excel 2016 sul computer fisso del piano -1 — possa aprire e usare senza errori.

CERCA.X non esiste in Excel 2016. Se la bibliotecaria usa CERCA.X, la collega vede solo un errore #NOME? su ogni cella. Possibile scenario di crisi diplomatica tra piani. Qui vince CERCA.VERT, punto.

Soluzione · CERCA.VERT (compatibilità)
CERCA.VERT(A2; Catalogo!A:D; 2; FALSO)
→ Cerca l'ISBN in A2, restituisce il titolo (colonna 2). Funziona su qualsiasi versione di Excel.

Pro Tip

Se non siete sicuri di quale versione di Excel usino i vostri colleghi, andate su File → Salva con nome e guardate se c’è un avviso di compatibilità. O chiedete direttamente. È socialmente accettabile.

Esempio 2 · Ambulatorio Medico · Vince CERCA.X
La colonna di ricerca non è la prima

L’amministrativa dell’ambulatorio ha una tabella pazienti: cognome in colonna A, nome in B, codice fiscale in C, medico di riferimento in D, data ultima visita in E. Deve cercare i pazienti per codice fiscale (colonna C) e restituire il medico (colonna D).

Con CERCA.VERT, la colonna di ricerca deve essere la prima. Il codice fiscale è in colonna C. Quindi dovrebbe spostare le colonne, rompendo probabilmente altri riferimenti, oppure usare il classico trucco INDEX+CONFRONTA. Oppure — semplicemente — usare CERCA.X che non ha questo problema.

Soluzione · CERCA.X (ricerca su qualsiasi colonna)
CERCA.X(F2; TabellaPazienti[CodiceFiscale]; TabellaPazienti[MedicoRiferimento]; "Paziente non trovato")
→ Cerca il CF in F2 nella colonna CF, restituisce il medico. Nessun bisogno di spostare colonne.

Esempio 3 · Scuola · Vince CERCA.X
Trovare l’ultima occorrenza (il voto più recente)

La segreteria scolastica tiene un registro voti con migliaia di righe: ogni volta che un professore inserisce un voto, aggiunge una riga. Lo stesso studente ha decine di righe. La dirigente vuole sapere l’ultimo voto inserito per ogni studente — cioè il più recente, che è l’occorrenza più in basso nella tabella.

CERCA.VERT trova sempre la prima occorrenza dall’alto. Non esiste modo nativo di fargli trovare l’ultima. Con CERCA.X basta impostare la modalità di ricerca a -1: cerca dall’ultima riga verso l’alto, quindi trova l’occorrenza più recente.

Soluzione · CERCA.X (ultima occorrenza)
CERCA.X(A2; RegistroVoti[IDStudente]; RegistroVoti[Voto]; "Nessun voto"; 0; -1)
→ Modalità -1: cerca dall'ultima riga. Restituisce il voto più recente dell'alunno.

Pro Tip

La modalità -1 di CERCA.X è anche utile negli help desk e nei magazzini per trovare l’ultima transazione o l’ultimo aggiornamento di stato su un ticket o un ordine. Ogni volta che avete dati temporali con duplicati e volete l’ultimo, pensate a CERCA.X con modalità -1.

Esempio 4 · Negozio / Punto Vendita · Vince CERCA.VERT
Tabelle semplificate con struttura fissa

Il responsabile del negozio ha una tabella prezzi con codice prodotto in colonna A e prezzo in colonna B. Due colonne. La usa da anni. La struttura non cambia mai. La deve inviare ogni settimana ai tre punti vendita che hanno tutti Excel diversi, incluso un tablet con Excel Mobile.

In questo caso CERCA.VERT è perfettamente adeguato e universalmente compatibile. Non c’è nessun vincolo di colonna da aggirare, nessuna necessità di gestione errori avanzata, nessuna ricerca inversa. Usare CERCA.X qui non aggiunge nulla, e rischia di rompere il file sui dispositivi più vecchi. Semplicità vince.

Soluzione · CERCA.VERT (semplicità e compatibilità)
CERCA.VERT(A2; ListinoPrezzi!A:B; 2; FALSO)
→ Cerca il codice prodotto, restituisce il prezzo. Funziona ovunque, anche su Excel Mobile.

“La funzione più giusta non è sempre la più nuova. È quella che risolve il problema senza crearne di nuovi.”


CERCA.X e CERCA.VERT dentro altre funzioni: 3 esempi

Finora abbiamo usato le funzioni CERCA da sole. Ma Excel diventa davvero potente quando iniziate a usarle come ingredienti all’interno di formule più grandi. Il valore cercato diventa l’input per un calcolo, una condizione, o un’altra funzione. Queste tre situazioni vi capiteranno quasi sicuramente.

Nidificazione 1 · Ufficio HR · SE + CERCA.X
Calcolo bonus condizionale basato sul livello del dipendente

Il reparto HR deve calcolare il bonus di fine anno. La regola: se il livello del dipendente (recuperato dalla tabella HR) è “Senior”, si applica un bonus del 15% sullo stipendio base. Altrimenti, nessun bonus.

Un approccio ingenuo: prima si fa una colonna con CERCA.X per recuperare il livello, poi si fa un’altra colonna con SE che legge quella colonna. Risultato: due colonne, doppio lavoro, doppia possibilità di sbagliare.

L’approccio corretto: si usa CERCA.X direttamente come argomento del SE. La funzione SE valuta il risultato di CERCA.X senza che voi abbiate bisogno di vederlo in una cella separata.

Formula · SE(CERCA.X(...))
SE(
CERCA.X(A2; TabellaHR[ID]; TabellaHR[Livello])= "Senior";
B2 * 1.15;
B2
)
→ Se il livello trovato è "Senior" → stipendio + 15%. Altrimenti → stipendio invariato.

La formula si aggiorna automaticamente ogni volta che la tabella HR viene modificata. Nessun copia-incolla manuale. Nessuna colonna di servizio. Nessun martedì pomeriggio dedicato ad aggiornare le cose a mano.

Pro Tip

Questo schema — SE(CERCA.X(...)="valore"; azione_se_vero; azione_se_falso) — è uno dei pattern più utili di tutto Excel. Imparatelo a memoria. Usatelo ogni volta che dovete prendere una decisione basata su un dato che si trova in un’altra tabella.


Nidificazione 2 · Farmacia / Magazzino · SOMMA.SE + CERCA.VERT
Sommare le scorte di tutti i prodotti appartenenti a una categoria

Il magazziniere della farmacia ha una tabella scorte con codice prodotto, quantità, e categoria. Deve creare un riepilogo che mostri la quantità totale per ogni categoria. Ma non ha la categoria direttamente nella colonna giusta — deve recuperarla dalla tabella prodotti per ogni articolo.

La soluzione è usare CERCA.VERT come argomento del criterio in SOMMA.SE, oppure — ancora più elegante — costruire una colonna ausiliaria con CERCA.VERT e poi usarla come criterio. In questo caso mostriamo l’approccio a colonna ausiliaria, che è più leggibile e meno soggetto a errori.

Colonna ausiliaria · Recupero categoria
CERCA.VERT(A2; TabellaProdotti!A:C; 3; FALSO)
→ Recupera la categoria per ogni codice prodotto. Ora avete la categoria in colonna D.
Formula finale · SOMMA.SE sulla colonna con la categoria
SOMMA.SE(D:D; "Antidolorifici"; B:B)
→ Somma tutte le quantità (colonna B) dove la categoria (colonna D) è "Antidolorifici".

Risultato: un riepilogo dinamico per categoria che si aggiorna ogni volta che cambiano le scorte o la tabella prodotti. Il magazziniere non deve più calcolare niente a mano e può smettere di usare la calcolatrice del telefono tenendola nascosta sotto il bancone.

Nidificazione 3 · Help Desk · TESTO + CERCA.X
Costruire messaggi automatici con dati presi da una tabella

L’operatore dell’help desk deve generare automaticamente un testo riepilogativo per ogni ticket: “Ticket #1042 — Cliente: Mario Rossi — Priorità: Alta — Assegnato a: Giulia M.” L’ID ticket è in colonna A, tutti gli altri dati sono in una tabella separata.

La soluzione è usare più CERCA.X dentro una funzione CONCATENA (o direttamente con l’operatore &), costruendo la stringa pezzo per pezzo con i dati recuperati dalla tabella.

Formula · Costruzione messaggio con CERCA.X annidato
"Ticket #"&A2&" — Cliente: "&
CERCA.X(A2; Ticket[ID]; Ticket[Cliente]) &
" — Priorità: "&
CERCA.X(A2; Ticket[ID]; Ticket[Priorità]) &
" — Assegnato a: "&
CERCA.X(A2; Ticket[ID]; Ticket[Operatore])
→ Risultato: "Ticket #1042 — Cliente: Mario Rossi — Priorità: Alta — Assegnato a: Giulia M."

Pro Tip

Questo approccio è la base per costruire template di email, report automatici, o etichette stampabili direttamente da Excel. Ogni volta che vi trovate a copiare dati a mano per riempire un testo sempre uguale, pensate a questo pattern.


Altre funzioni dentro CERCA.X: 3 esempi

Ora andiamo dall’altra parte: funzioni annidate all’interno di CERCA.X. Invece di fornire un valore statico da cercare, fornite il risultato di una formula. Questo permette di fare ricerche dinamiche, trasformare i dati prima di cercarli, o calcolare il valore cercato al volo.

Dentro CERCA 1 · Magazzino / Logistica · CERCA.X con GIORNI.LAVORATIVI.TOT
Calcolare la data di consegna prevista in base al lead time del fornitore

Il responsabile logistico ha una tabella fornitori con ID fornitore e giorni di lead time. Per ogni ordine vuole calcolare la data di consegna prevista: data ordine + lead time del fornitore, saltando weekend e festivi. Il tutto in una cella sola, senza colonne di appoggio.

La soluzione: si annida CERCA.X come argomento di GIORNO.LAVORATIVO, che calcola una data lavorativa futura aggiungendo un numero di giorni lavorativi a una data di partenza. I giorni vengono presi dinamicamente dalla tabella fornitori tramite CERCA.X.

Formula · GIORNO.LAVORATIVO(data; CERCA.X(fornitore))
GIORNO.LAVORATIVO(
B2;← data dell'ordine
CERCA.X(A2; Fornitori[ID]; Fornitori[LeadDays]; 0)
)
→ Aggiunge i giorni lavorativi di lead time del fornitore alla data ordine. Se il fornitore non esiste: 0 giorni aggiunti.

Il parametro se_non_trovato = 0 di CERCA.X fa sì che i fornitori nuovi, non ancora in tabella, non generino errori: semplicemente la data di consegna coincide con la data dell’ordine, segnalando implicitamente che mancano dati.

Pro Tip

GIORNO.LAVORATIVO accetta un terzo parametro opzionale: l’elenco dei giorni festivi. Se avete una colonna con le festività nazionali (Natale, Ferragosto, ecc.), inseritela lì e la funzione le salterà automaticamente nei calcoli.


Dentro CERCA 2 · Ufficio Commerciale · CERCA.X con MAIUSC e ANNULLA.SPAZI
Cercare un cliente anche quando il nome è stato digitato male

Il commerciale riceve email con nomi di aziende cliente scritti in modi diversi: a volte tutto maiuscolo, a volte con spazi in più, a volte con maiuscole miste. La tabella CRM tiene i nomi in maiuscolo senza spazi extra. La ricerca diretta fallisce perché "mario srl""MARIO SRL".

La soluzione è normalizzare il valore cercato prima di passarlo a CERCA.X, usando MAIUSC per convertire tutto in maiuscolo e ANNULLA.SPAZI per eliminare gli spazi superflui. Si annidano entrambe le funzioni come primo argomento di CERCA.X.

Formula · CERCA.X(MAIUSC(ANNULLA.SPAZI(...)))CERCA.X(
MAIUSC(ANNULLA.SPAZI(A2));
CRM[NomeCliente];
CRM[ResponsabileCommerciale];
"Cliente non trovato nel CRM"
)
→ Normalizza il testo in A2 prima di cercare. " mario srl " diventa "MARIO SRL" e viene trovato.

Attenzione

Questo funziona solo se anche i dati nella colonna di ricerca della tabella CRM sono in maiuscolo senza spazi. Se i dati sono disomogenei anche lì, dovete applicare la stessa normalizzazione anche alla colonna di ricerca — e a quel punto conviene pulire i dati alla fonte, non fare acrobazia con le formule.

Dentro CERCA 3 · Scuola · CERCA.X con OGGI e confronto date
Trovare automaticamente il docente di turno in base alla data odierna

La segreteria ha una tabella con le date dei turni di sorveglianza e il nome del docente assegnato per ciascuna data. Ogni mattina qualcuno apre il file e vuole sapere subito chi è di turno oggi, senza cercare manualmente nella tabella.

La soluzione è usare la funzione OGGI() come valore da cercare all’interno di CERCA.X. OGGI() restituisce sempre la data corrente, quindi la formula trova automaticamente il docente di turno per il giorno in cui viene aperto il file. Zero interazione manuale.

Formula · CERCA.X(OGGI(); ...)
CERCA.X(
OGGI();
Turni[Data];
Turni[DocenteDiTurno];
"Nessun turno programmato per oggi"
)
→ Ogni volta che il file viene aperto, mostra automaticamente il docente di turno per oggi.

Il parametro se_non_trovato gestisce i weekend e i giorni non programmati senza generare errori — fondamentale se il file viene aperto anche di sabato dal vicedirettore ansioso.

Pro Tip

Questo stesso schema — CERCA.X(OGGI(); ...) — funziona per qualsiasi tabella con date: orari di apertura stagionali, prezzi che cambiano per periodo, disponibilità di risorse per data. È uno dei pattern più sottovalutati e più utili di Excel.


Riepilogo: cosa portarsi a casa

Se doveste spiegare tutto questo a un collega in tre minuti davanti alla macchinetta del caffè, ecco cosa direste:

CERCA.VERT è stabile, universale, e funziona su qualsiasi versione di Excel. Ha due grandi limiti: la colonna di ricerca deve essere la prima, e non gestisce gli errori nativamente. Va benissimo per tabelle semplici e file condivisi con persone che usano Excel vecchio.

CERCA.X è la versione moderna e priva di quei limiti. Cerca in qualsiasi colonna, gestisce i valori non trovati con il parametro se_non_trovato, può cercare dall’ultima riga, e si legge molto più facilmente. Usatelo ogni volta che il vostro Excel lo supporta (Microsoft 365 e Excel 2021 in poi).

Nidificazione: entrambe le funzioni diventano molto più potenti quando le combinate con SE, SOMMA.SE, TESTO, CONCATENA come funzioni esterne, oppure con OGGI, MAIUSC, ANNULLA.SPAZI, GIORNO.LAVORATIVO come argomenti interni. Imparate i pattern, non le singole formule.

E la prossima volta che vedete #N/D, non prendete a calci il computer. Controllate prima se c’è uno spazio invisibile. Quasi sempre è quello. Quasi sempre.

Pro Tip Finale

Selezionate una cella con il valore non trovato, premete F2 per entrare in modifica, e guardate bene i bordi del testo: se il cursore parte un po’ più a destra del primo carattere, c’è uno spazio davanti. Usate ANNULLA.SPAZI e vivete felici.

VLookup and XLookup – The definitive guide

Everything you ever wanted to know, explained in plain human terms, with real examples, and without making you cry in front of an Excel spreadsheet.

Every year, millions of people open Excel, stare at two separate tables, and think: “there must be a way to connect these things without copying them one by one.” There is. It’s called VLOOKUP. And for a few years now there’s also XLOOKUP, which does the same thing but without the embarrassing flaws. This is the guide nobody ever made you read before leaving you alone with a #N/A error and a ruined Tuesday afternoon.


VLOOKUP: the classic that never goes out of style (but throws tantrums)

VLOOKUP stands for Vertical Lookup. In practice: you give it a value, it goes and finds it in a column of a table, and returns the corresponding value from another column in the same row. Like a waiter who looks up your name on the reservation list and tells you which table you’re sitting at.

Simple in theory. In practice, as we’ll see, that waiter sometimes says #N/A and disappears into the kitchen.

The full syntax

VLOOKUP(lookup_value; table_array; col_index_num; [range_lookup])
ParameterWhat it doesExample
lookup_value – requiredThe value you want to look up. Can be text, a number, or a cell reference.A2 (the cell containing the employee code)
table_array – requiredThe table to search in. Important: the lookup column MUST be the first column (leftmost) of this selection.B2:E500 or HRTable[#All]
col_index_num – requiredThe column number within the table from which to return the result. If the table has 4 columns and you want the third, type 3.3 (returns the value from the 3rd column)
range_lookup – optionalFALSE = exact match (almost always what you want). TRUE = approximate match (useful for brackets, e.g. taxes, score ranges). Default: TRUE, so always type FALSE if you’re not sure.FALSE

Classic trap

The range_lookup parameter defaults to TRUE. This means that if you forget it, Excel will perform an approximate match. On unsorted data, this produces wrong results without warning you. No error. Silently. Like a colleague who misunderstood the instructions but won’t admit it.

Basic VLOOKUP example

VLOOKUP(A2; SalaryTable; 3; FALSE)
→ Looks up the code in A2 in the first column of SalaryTable, returns the value from the 3rd column

Pro Tip

Always use structured table references (Table1[Column]) instead of hard-coded ranges (B2:E500). If you add rows to the table, the formula updates automatically. If you use a hard-coded range, you’ll have to remember to update it manually — and you will definitely forget at the worst possible moment.


XLOOKUP: the younger sibling who turned out better

XLOOKUP arrived in 2019 with Microsoft 365 and fixed virtually all of VLOOKUP’s structural problems. It’s not just “a newer VLOOKUP” — it’s a completely redesigned function that works differently, more flexibly, and more intuitively.

If VLOOKUP is the waiter who searches the list from top to bottom and can only look to the right, XLOOKUP is the maître d’ who can look anywhere, tell you if you’re not on the list without making a scene, and even search starting from the end.

The full syntax

XLOOKUP(lookup_value; lookup_array; return_array; [if_not_found]; [match_mode]; [search_mode])
ParameterWhat it doesExample
lookup_value – requiredThe value you want to find. Identical to VLOOKUP.A2
lookup_array – requiredThe column (or row) to search in. Doesn’t have to be the first one. Can be any column in the table.ClientsTable[ID]
return_array – requiredThe column (or row) to return the result from. Completely separate from the lookup column. Can be to the left, to the right, anywhere.ClientsTable[ClientName]
if_not_found – optionalWhat to return if the value is not found. If omitted, returns #N/A. With this parameter, you can return custom text, zero, or anything else."Not found" or 0
match_mode – optional0 = exact match (default). -1 = exact or next smaller. 1 = exact or next larger. 2 = with wildcard characters (*, ?).0
search_mode – optional1 = first to last row (default). -1 = last to first (useful if you want the most recent occurrence). 2 or -2 = binary search (on sorted data, much faster).-1 (to find the most recent row)

Pro Tip

The if_not_found parameter alone is worth switching to XLOOKUP. The old IFERROR(VLOOKUP(...); "Not found") is verbose and repeats the formula twice. With XLOOKUP you write it once, clean, readable — and your colleagues will look at you with respect.

XLOOKUP(A2; ClientsTable[ID]; ClientsTable[ClientName]; "Client not registered")
→ Looks up A2 in the ID column, returns the ClientName. If not found: "Client not registered"

When to use one and when to use the other: 4 real examples

The short answer: always use XLOOKUP if your Excel supports it. But life is complicated, colleagues use older versions of Office, and sometimes there are legitimate reasons why VLOOKUP is still the right choice. Here they are.

VLOOKUP · Limitations

  • The lookup column must be the first one (leftmost)
  • References columns by number, not by name
  • No native error handling
  • Cannot search right to left
  • Cannot find the last occurrence

XLOOKUP · Advantages

  • Search in any column, return from any column
  • Uses column names, not arbitrary numbers
  • Built-in error handling with if_not_found
  • Searches in both directions
  • Finds the last occurrence with search mode -1

Example 1 · Library · VLOOKUP wins
File shared with colleagues on Excel 2016

The librarian has a catalogue with 8,000 books: ISBN code in column A, title in B, author in C, section in D. She needs to create a file that her part-time colleague — who uses Excel 2016 on the desktop computer in the basement — can open and use without errors.

XLOOKUP doesn’t exist in Excel 2016. If the librarian uses XLOOKUP, the colleague sees nothing but a #NAME? error on every cell. A potential diplomatic incident between floors. VLOOKUP wins here, full stop.

Solution · VLOOKUP (compatibility)
VLOOKUP(A2; Catalogue!A:D; 2; FALSE)
→ Looks up the ISBN in A2, returns the title (column 2). Works on any version of Excel.

Pro Tip

If you’re not sure which version of Excel your colleagues are using, go to File → Save As and check for a compatibility warning. Or just ask them directly. It’s socially acceptable.

Example 2 · Medical Practice · XLOOKUP wins
The lookup column is not the first one

The administrator at a medical practice has a patient table: surname in column A, first name in B, tax ID in C, assigned doctor in D, date of last visit in E. She needs to look up patients by tax ID (column C) and return the doctor (column D).

With VLOOKUP, the lookup column must be the first one. The tax ID is in column C. So she would have to move the columns around — probably breaking other references — or use the classic INDEX+MATCH trick. Or simply use XLOOKUP, which doesn’t have this problem.

Solution · XLOOKUP (search on any column)
XLOOKUP(F2; PatientsTable[TaxID]; PatientsTable[AssignedDoctor]; "Patient not found")
→ Looks up the tax ID in F2 in the TaxID column, returns the doctor. No need to move columns.

Example 3 · School · XLOOKUP wins
Finding the last occurrence (the most recent grade)

The school office keeps a grade register with thousands of rows: every time a teacher enters a grade, they add a row. The same student has dozens of rows. The principal wants to know the last grade entered for each student — i.e. the most recent one, which is the lowest occurrence in the table.

VLOOKUP always finds the first occurrence from the top. There is no native way to make it find the last one. With XLOOKUP, just set the search mode to -1: it searches from the last row upwards, so it finds the most recent occurrence.

Solution · XLOOKUP (last occurrence)
XLOOKUP(A2; GradeRegister[StudentID]; GradeRegister[Grade]; "No grade"; 0; -1)
→ Mode -1: searches from the last row. Returns the student's most recent grade.

Pro Tip

The -1 mode in XLOOKUP is also useful in help desks and warehouses to find the latest transaction or the most recent status update on a ticket or order. Whenever you have time-based data with duplicates and want the latest entry, think XLOOKUP with mode -1.

Example 4 · Shop / Point of Sale · VLOOKUP wins
Simplified tables with a fixed structure

The store manager has a price table with product code in column A and price in column B. Two columns. He’s used it for years. The structure never changes. He sends it every week to three branches, all of which run different versions of Excel — including a tablet running Excel Mobile.

In this case VLOOKUP is perfectly adequate and universally compatible. There’s no column constraint to work around, no need for advanced error handling, no reverse search. Using XLOOKUP here adds nothing and risks breaking the file on older devices. Simplicity wins.

Solution · VLOOKUP (simplicity and compatibility)
VLOOKUP(A2; PriceList!A:B; 2; FALSE)
→ Looks up the product code, returns the price. Works everywhere, including Excel Mobile.

“The right function isn’t always the newest one. It’s the one that solves the problem without creating new ones.”


XLOOKUP and VLOOKUP inside other functions: 3 examples

So far we’ve used lookup functions on their own. But Excel becomes truly powerful when you start using them as ingredients inside larger formulas. The looked-up value becomes the input for a calculation, a condition, or another function. These three situations will almost certainly come up for you.

Nesting 1 · HR Office · IF + XLOOKUP
Conditional bonus calculation based on employee level

The HR department needs to calculate the end-of-year bonus. The rule: if the employee’s level (retrieved from the HR table) is “Senior”, a 15% bonus is applied to the base salary. Otherwise, no bonus.

A naive approach: first make a column with XLOOKUP to retrieve the level, then make another column with IF that reads that column. Result: two columns, double the work, double the chance of making a mistake.

The correct approach: use XLOOKUP directly as an argument of IF. The IF function evaluates the result of XLOOKUP without you needing to see it in a separate cell.

Formula · IF(XLOOKUP(...))
IF(
XLOOKUP(A2; HRTable[ID]; HRTable[Level])= "Senior";
B2 * 1.15;
B2
)
→ If the level found is "Senior" → salary + 15%. Otherwise → salary unchanged.

The formula updates automatically every time the HR table is modified. No manual copy-pasting. No helper columns. No Tuesday afternoon spent updating things by hand.

Pro Tip

This pattern — IF(XLOOKUP(...)="value"; action_if_true; action_if_false) — is one of the most useful patterns in all of Excel. Learn it by heart. Use it every time you need to make a decision based on data that lives in another table.


Nesting 2 · Pharmacy / Warehouse · SUMIF + VLOOKUP
Summing stock for all products belonging to a category

The pharmacy warehouse manager has a stock table with product code, quantity, and category. He needs to create a summary showing the total quantity for each category. But he doesn’t have the category directly in the right column — he needs to retrieve it from the product table for each item.

The solution is to use VLOOKUP as the criteria argument in SUMIF, or — even more elegantly — build a helper column with VLOOKUP and then use it as the criteria. Here we show the helper column approach, which is more readable and less error-prone.

Helper column · Retrieving the category
VLOOKUP(A2; ProductTable!A:C; 3; FALSE)
→ Retrieves the category for each product code. You now have the category in column D.
Final formula · SUMIF on the category column
SUMIF(D:D; "Painkillers"; B:B)
→ Sums all quantities (column B) where the category (column D) is "Painkillers".

Result: a dynamic category summary that updates every time the stock or product table changes. The warehouse manager no longer has to calculate anything by hand and can stop using the phone calculator he keeps hidden under the counter.

Nesting 3 · Help Desk · TEXT + XLOOKUP
Building automatic messages with data pulled from a table

The help desk operator needs to automatically generate a summary text for each ticket: “Ticket #1042 — Client: John Smith — Priority: High — Assigned to: Julia M.” The ticket ID is in column A, all other data is in a separate table.

The solution is to use multiple XLOOKUPs inside a CONCATENATE function (or directly with the & operator), building the string piece by piece with data retrieved from the table.

Formula · Building a message with nested XLOOKUP
"Ticket #"&A2&" — Client: "&
XLOOKUP(A2; Tickets[ID]; Tickets[Client]) &
" — Priority: "&
XLOOKUP(A2; Tickets[ID]; Tickets[Priority]) &
" — Assigned to: "&
XLOOKUP(A2; Tickets[ID]; Tickets[Operator])
→ Result: "Ticket #1042 — Client: John Smith — Priority: High — Assigned to: Julia M."

Pro Tip

This approach is the foundation for building email templates, automated reports, or printable labels directly from Excel. Every time you find yourself copying data by hand to fill in the same text over and over, think of this pattern.


Other functions inside XLOOKUP: 3 examples

Now let’s go the other way: functions nested inside XLOOKUP. Instead of providing a static value to look up, you provide the result of a formula. This allows you to perform dynamic lookups, transform data before searching, or calculate the lookup value on the fly.

Inside LOOKUP 1 · Warehouse / Logistics · XLOOKUP with NETWORKDAYS
Calculating the expected delivery date based on supplier lead time

The logistics manager has a supplier table with supplier ID and lead time in days. For each order he wants to calculate the expected delivery date: order date + supplier lead time, skipping weekends and public holidays. All in a single cell, with no helper columns.

The solution: nest XLOOKUP as an argument of WORKDAY, which calculates a future working date by adding a number of working days to a start date. The days are pulled dynamically from the supplier table via XLOOKUP.

Formula · WORKDAY(date; XLOOKUP(supplier))
WORKDAY(
B2; ← order date
XLOOKUP(A2; Suppliers[ID]; Suppliers[LeadDays]; 0)
)
→ Adds the supplier's lead time working days to the order date. If the supplier doesn't exist: 0 days added.

The if_not_found = 0 parameter of XLOOKUP ensures that new suppliers not yet in the table don’t generate errors — the delivery date simply matches the order date, implicitly signalling that data is missing.

Pro Tip

WORKDAY accepts an optional third parameter: a list of public holidays. If you have a column with national holidays (Christmas, bank holidays, etc.), add it there and the function will automatically skip them in its calculations.


Inside LOOKUP 2 · Sales Office · XLOOKUP with UPPER and TRIM
Finding a client even when the name has been typed incorrectly

The sales rep receives emails with client company names written in different ways: sometimes all caps, sometimes with extra spaces, sometimes with mixed capitalisation. The CRM table stores names in uppercase with no extra spaces. A direct lookup fails because "mario srl""MARIO SRL".

The solution is to normalise the lookup value before passing it to XLOOKUP, using UPPER to convert everything to uppercase and TRIM to remove extra spaces. Both functions are nested as the first argument of XLOOKUP.

Formula · XLOOKUP(UPPER(TRIM(...)))
XLOOKUP(
UPPER(TRIM(A2));
CRM[ClientName];
CRM[SalesRep];
"Client not found in CRM"
)
→ Normalises the text in A2 before searching. " mario srl " becomes "MARIO SRL" and is found.

Watch out

This only works if the data in the lookup column of the CRM table is also in uppercase with no extra spaces. If the data there is inconsistent too, you’ll need to apply the same normalisation to the lookup column as well — and at that point it’s better to clean the data at the source rather than doing acrobatics with formulas.

Inside LOOKUP 3 · School · XLOOKUP with TODAY and date comparison
Automatically finding the teacher on duty based on today’s date

The school office has a table with supervision duty dates and the name of the teacher assigned to each date. Every morning someone opens the file and wants to immediately know who is on duty today, without manually searching through the table.

The solution is to use the TODAY() function as the lookup value inside XLOOKUP. TODAY() always returns the current date, so the formula automatically finds the teacher on duty for the day the file is opened. Zero manual interaction.

Formula · XLOOKUP(TODAY(); ...)
XLOOKUP(
TODAY();
Duties[Date];
Duties[TeacherOnDuty];
"No duty scheduled for today"
)
→ Every time the file is opened, it automatically shows the teacher on duty for today.

The if_not_found parameter handles weekends and unscheduled days without generating errors — essential if the file gets opened on a Saturday by an anxious deputy head.

Pro Tip

This same pattern — XLOOKUP(TODAY(); ...) — works for any table with dates: seasonal opening hours, prices that change by period, resource availability by date. It’s one of the most underrated and most useful patterns in Excel.


Summary: what to take away

If you had to explain all of this to a colleague in three minutes by the coffee machine, here’s what you’d say:

VLOOKUP is stable, universal, and works on any version of Excel. It has two major limitations: the lookup column must be the first one, and it doesn’t handle errors natively. It’s perfectly fine for simple tables and files shared with people using older versions of Excel.

XLOOKUP is the modern version without those limitations. It searches in any column, handles missing values with the if_not_found parameter, can search from the last row, and is much easier to read. Use it whenever your Excel supports it (Microsoft 365 and Excel 2021 onwards).

Nesting: both functions become far more powerful when you combine them with IF, SUMIF, TEXT, CONCATENATE as outer functions, or with TODAY, UPPER, TRIM, WORKDAY as inner arguments. Learn the patterns, not the individual formulas.

And the next time you see #N/A, don’t kick the computer. First check whether there’s an invisible space. It almost always is. Almost always.

Final Pro Tip

Select a cell with the value that isn’t being found, press F2 to enter edit mode, and look carefully at the edges of the text: if the cursor starts slightly to the right of the first character, there’s a leading space. Use TRIM and live happily ever after.