À propos de cet exercice
Un jeu de données de 125 lignes sur 2 feuilles, une cellule de réponse, environ 6 minutes. Corrigé dans votre navigateur : la valeur et la formule qui la produit, avec des indications sur la correction à apporter.
Comment le résoudre
- Timesheet!E2
=INDEX(Staff!$D$2:$D$26,MATCH(C2,Staff!$A$2:$A$26,0))
MATCH(C2,Staff!A2:A26,0) answers "which row of the ID list holds this ID?" with a position — a 1 for the first employee, 25 for the last — and the 0 insists on an exact match. INDEX(Staff!D2:D26, position) then returns the cell of the rate column at that same position. The two functions split the lookup into "find the row" and "read the column", which is why the rate column can be anywhere — left, right or on another sheet — and why inserting a column in Staff never breaks the formula.
Pitfall 1: the INDEX range and the MATCH range must be aligned — Staff!D1:D26 with Staff!A2:A26 is off by one and returns the previous employee's rate for everyone, with no error to warn you. Pitfall 2: leaving out the 0 in MATCH switches to approximate match; on this unsorted roster that returns wrong positions silently. Pitfall 3: MATCH returns #N/A when the ID is missing; wrap the whole INDEX in IFERROR or IFNA when the timesheet can contain IDs of leavers. INDEX/MATCH vs VLOOKUP: same result as =VLOOKUP(C2,Staff!$A$2:$D$26,4,FALSE) here, but INDEX/MATCH looks left, survives inserted columns, and on big tables a single MATCH can feed several INDEX formulas (rate, department, name) instead of repeating the search. In Excel 365, =XLOOKUP(C2,Staff!$A$2:$A$26,Staff!$D$2:$D$26) is the one-function replacement; INDEX/MATCH remains the form that opens in every Excel version and in most other spreadsheet tools.
Autres méthodes valables
- =INDEX(Staff!$A$2:$D$26,MATCH(C2,Staff!$A$2:$A$26,0),4) — INDEX over the whole table with a column number
- =IFERROR(INDEX(Staff!$D$2:$D$26,MATCH(C2,Staff!$A$2:$A$26,0)),"Unknown ID") — with a fallback for IDs that are not on the roster
- =XLOOKUP(C2,Staff!$A$2:$A$26,Staff!$D$2:$D$26) — Excel 365 equivalent (not accepted here: this task practices INDEX and MATCH)
Erreurs fréquentes
Swapping the roles: =MATCH(C2,Staff!$D$2:$D$26,0) or =INDEX(Staff!$A$2:$A$26,…) — MATCH must search the column that contains the key (IDs), INDEX must return from the column you want (rates).
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.