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. Text functions

LEFT, MID and RIGHT practice: split 120 SKU codes into category, year and serial

  • Débutant
  • ~6 min
  • Text functions

Énoncé en anglais

A warehouse export lists 120 products whose SKU encodes three facts in a fixed pattern — category code, launch year, serial number — for example DEC-2019-1375: category DEC, launched in 2019, serial 1375. Purchasing wants to filter by category and compute each product's age, so the three parts must live in their own columns. Split every SKU into E (category), F (year as a number) and G (serial, keeping its leading zero — 15 of the serials start with 0).

Ce que vous devez faire

  1. 1Click E2 and type =LEFT(A2,3): the first three characters are the category code (DEC). Fill down to E121.
  2. 2Click F2 and type =MID(A2,5,4) to pull four characters starting at position 5 — the year. MID returns text, so wrap it: =VALUE(MID(A2,5,4)) or =MID(A2,5,4)*1 turns "2019" into the number 2019 (right-aligned). Fill down to F121.
  3. 3Click G2 and type =RIGHT(A2,4): the last four characters are the serial, kept as text so "0114" does not lose its leading zero. Fill down to G121.
  4. 4Fill each column with the fill handle or Ctrl+D (Windows) / ⌘D (Mac) on the selected range E2:E121, F2:F121, G2:G121.

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, use LEFT to extract the three-letter category code from the SKU in A2, then fill down to E121.
  2. Non vérifiéIn F2, use MID to extract the four-digit launch year (characters 5–8) and convert it to a number — MID returns text, so wrap it in VALUE or multiply by 1 — then fill down to F121.
  3. Non vérifiéIn G2, use RIGHT to extract the four-character serial number as text (so a leading zero is kept), then fill down to G121.

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 120 lignes sur une feuille, 3 cellules 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

  • E2=LEFT(A2,3)
  • F2=VALUE(MID(A2,5,4))
  • G2=RIGHT(A2,4)

LEFT, MID and RIGHT cut a fixed number of characters out of a text: LEFT(A2,3) takes the first three, RIGHT(A2,4) the last four, and MID(A2,5,4) four characters starting at position 5. They work here because every SKU follows the same 13-character pattern, so the positions never change from row to row. All three return text — which is exactly right for the serial (0114 keeps its zero) but wrong for the year, so the year is wrapped in VALUE to become a real number.

Pitfall 1 (the classic test trap): =MID(A2,5,4) shows 2019 left-aligned — it is text. SUM over the column returns 0, =F2>2022 compares alphabetically, and a filter lists "2019" under text values. VALUE, NUMBERVALUE, *1, +0 or the double unary -- all convert it. Pitfall 2: the opposite mistake on the serial — =VALUE(RIGHT(A2,4)) turns 0142 into 142 and the leading zero is gone for good; keep identifiers as text or re-pad with TEXT(n,"0000"). Pitfall 3: fixed positions break the moment a category code has two or four letters; for variable-width parts use FIND("-",A2) to locate the hyphen (see the e-mail split exercise) or TEXTSPLIT(A2,"-") in Excel 365. MID is forgiving: asking for more characters than remain simply returns what is there, so =MID(A2,10,99) is a common idiom for "everything after position 9". Version note: TEXTBEFORE, TEXTAFTER and TEXTSPLIT (Excel 365 only) do the same job without counting characters; LEFT/MID/RIGHT work in every version and in every other spreadsheet tool. Flash Fill (Ctrl+E) can guess these splits interactively, but it produces static values that do not update when a SKU changes — formulas do.

Autres méthodes valables

  • =MID(A2,5,4)*1 or =--MID(A2,5,4) — arithmetic coercion instead of VALUE
  • =NUMBERVALUE(MID(A2,5,4)) — explicit conversion, locale-aware
  • =MID(A2,10,4) — the serial via MID instead of RIGHT (same text)
  • =TEXTBEFORE(A2,"-") / =TEXTAFTER(A2,"-",-1) — Excel 365 only, position-free

Erreurs fréquentes

Leaving the year as text: =MID(A2,5,4) returns "2019" (left-aligned, cannot be summed or compared as a number). Wrap it in VALUE or multiply by 1.

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 1Jour 2
  • Excel for Data AnalystsJour 1
  • Excel for Administrative AssistantsJour 6

Exercices associés

  • Split email into user and domain (FIND/LEFT/RIGHT or TEXTBEFORE/TEXTAFTER)Intermédiaire, ~7 min
  • Full name with CONCAT or &Débutant, ~4 min
  • Turn text dates into real dates and group by monthExpert, ~12 min

Référence de la fonction

Documentation officielle

Exercice suivant

Split email into user and domain (FIND/LEFT/RIGHT or TEXTBEFORE/TEXTAFTER)