Aller au contenu
GridBelt
  • Test Excel
  • Exercices
  • Programmes
  • Tarifs
Se connecter
Commencer le test gratuit
  • Test Excel
  • Exercices
  • Programmes
  • Tarifs
Se connecterCréer un compte
Commencer le test gratuit
GridBelt

Entraînez-vous sur Excel dans votre navigateur.

Test Excel

  • Niveau 1 : Débutant
  • Niveau 2 : Intermédiaire
  • Niveau 3 : Expert
  • Test Excel en 7 jours
  • Classement
  • Test Excel en entretien d’embauche
  • Évaluation Excel d’Indeed

Exercices

  • Tous les exercices
  • Programmes
  • Pour débutants

Guides

  • Formules Excel
  • Raccourcis Excel

Entreprise

  • À propos
  • Tarifs
  • Comment nous corrigeons

© GridBelt. Tous droits réservés.

  • Politique de confidentialité
  • Conditions d’utilisation
  • Politique de remboursement

Excel est une marque commerciale de Microsoft Corporation. Indeed, TestGorilla, SHL et les autres marques sont la propriété de leurs détenteurs respectifs. GridBelt est un site d’entraînement indépendant ; il n’est affilié ni à Microsoft, ni à TestGorilla, ni à SHL, ni à Indeed, et n’est ni cautionné ni sponsorisé par ces sociétés.

  1. Exercices
  2. /
  3. VLOOKUP

VLOOKUP with IFERROR practice: show "Not found" instead of #N/A

  • Intermédiaire
  • ~7 min
  • VLOOKUP

Énoncé en anglais

Purchasing exported 100 order lines for printer consumables (November 2026) and needs the current unit price on each line from the Products sheet, a 30-SKU catalogue. 5 lines still reference SKUs that were discontinued and removed from the catalogue, so a plain lookup shows #N/A on those rows and breaks every total built on the column. Pull the price with a lookup, replace the error with the text "Not found", and count how many lines have no price.

Ce que vous devez faire

  1. 1On Orders, click E2 and write the lookup first: =VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE) — click the Products tab and select A2:D31 to get the prefix, F4 / ⌘T to lock it.
  2. 2Wrap it: =IFERROR(VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE),"Not found") — IFERROR returns the lookup when it works and the text when it errors.
  3. 3Fill E2 down to E101; the 5 discontinued SKUs now read "Not found" instead of #N/A.
  4. 4Click H2 and count the lines without a price: a COUNTIF over E2:E101 for the text "Not found".

Cellules de réponse

Correction

Saisissez votre formule dans la grille, appuyez sur Enter, puis cliquez sur Vérifier. Nous corrigeons la valeur de chaque cellule de réponse et la formule qui la produit.

Tâches

  1. Non vérifiéIn E2, look up the unit price of the SKU in C2 on the Products sheet and show "Not found" instead of #N/A when the SKU is missing — IFERROR or IFNA around the lookup (XLOOKUP's if_not_found argument works too) — then fill down to E101.
  2. Non vérifiéIn H2, count how many cells in E2:E101 say "Not found".

Ordinateur recommandé pour les tâches dans la feuille de calcul. La feuille défile à l’intérieur de ce cadre.

StartInsertFormulasDataView
A1fxPréparation de votre classeur…
A
B
C
D
E
F
G
H
I
J
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Sheet1

Saisissez votre formule dans la feuille, puis vérifiez.

À propos de cet exercice

Un jeu de données de 130 lignes sur 2 feuilles, 2 cellules de réponse, environ 7 minutes. Corrigé dans votre navigateur : la valeur et la formule qui la produit, avec des indications sur la correction à apporter.

Comment le résoudre

  • Orders!E2=IFERROR(VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE),"Not found")
  • Orders!H2=COUNTIF(E2:E101,"Not found")

VLOOKUP with FALSE returns #N/A when the SKU is not in the first column of the table, and any SUM or AVERAGE over a column that contains #N/A becomes #N/A too. IFERROR(value, value_if_error) evaluates the lookup and, only if it produces an error, returns the second argument instead — here the text "Not found" — so the five discontinued lines become readable text and the rest keep their prices. COUNTIF over the finished column counts the text cells: 5 lines need a price decision.

Pitfall 1: IFERROR hides every error, including a #REF! from a broken table reference or a #VALUE! from a typo; IFNA replaces only #N/A, so a genuinely broken formula still shows its error — prefer IFNA when the only expected error is "no match". Pitfall 2: the fallback must be meaningful to whoever consumes the column; "Not found" works for humans, 0 is dangerous because it looks like a free item in totals, and an empty string "" silently disappears from counts. Pitfall 3: in Excel 2003 and earlier IFERROR did not exist, which is why old workbooks use =IF(ISNA(VLOOKUP(...)),"Not found",VLOOKUP(...)) — the lookup runs twice. Alternatives: =IFNA(VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE),"Not found"); =XLOOKUP(C2,Products!$A$2:$A$31,Products!$D$2:$D$31,"Not found") has the fallback built in as its 4th argument (365). Data-quality note: the count in H2 is the real deliverable — the five SKUs need either a replacement product or a clean-up of the order file, and the lookup column is where that gap becomes visible.

Autres méthodes valables

  • =IFNA(VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE),"Not found") — catches only #N/A, lets other errors through
  • =XLOOKUP(C2,Products!$A$2:$A$31,Products!$D$2:$D$31,"Not found") — Excel 365; the 4th argument is the fallback
  • =IF(ISNA(VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE)),"Not found",VLOOKUP(C2,Products!$A$2:$D$31,4,FALSE)) — the pre-2007 pattern
  • =COUNTA(E2:E101)-COUNT(E2:E101) in H2 — text cells = everything minus the numbers

Erreurs fréquentes

Putting the fallback inside VLOOKUP, e.g. =VLOOKUP(C2,Products!$A$2:$D$31,4,"Not found"): the 4th argument of VLOOKUP is the match type, not a fallback. The error handler wraps the whole lookup — IFERROR( lookup , "Not found" ).

Comment nous corrigeons

Toute formule qui produit le bon résultat est acceptée, sauf si la tâche nomme une fonction : une autre fonction rapporte alors la moitié des points. Nous comparons les valeurs avec une petite tolérance et ignorons la casse et les espaces dans le texte. Un nombre correct saisi à la main au lieu d’une formule rapporte la moitié des points. Les tâches sur plusieurs cellules rapportent tous les points avec 100 % de cellules justes, la moitié à partir de 50 %. Lorsque c’est pertinent, nous modifions aussi une cellule d’entrée sur une copie de votre feuille et vérifions que votre formule suit.

Réponses calculées selon les règles d’Excel 365 et vérifiées dans notre correcteur le 16 novembre 2026. Auteur : GridBelt team.

Dans ces programmes

  • Excel test in 7 days, Plan de niveau 2Jour 3
  • Excel for Administrative AssistantsJour 8
  • Excel for Accounting and BookkeepingJour 6

Exercices associés

  • Pull the unit price with VLOOKUP (exact match)Débutant, ~5 min
  • Look up a customer tier from another sheetDébutant, ~5 min
  • Replace VLOOKUP with XLOOKUPIntermédiaire, ~6 min
  • INDEX and MATCH exact lookupIntermédiaire, ~6 min

Référence de la fonction

Documentation officielle

Exercice suivant

Pick the month column with MATCH