Informazioni sull’esercizio
Un set di dati di 120 righe su un foglio, 3 celle di risposta, circa 6 minuti. Correzione nel tuo browser: il valore e la formula che lo produce, con indicazioni su cosa sistemare.
Come risolverlo
- 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.
Altri metodi validi
- =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
Errori comuni
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.
Come valutiamo
È accettata qualsiasi formula che produce il risultato giusto, a meno che l’attività non indichi una funzione: in quel caso un’altra funzione vale metà dei punti. Confrontiamo i valori con una piccola tolleranza e ignoriamo maiuscole, minuscole e spazi nel testo. Un numero corretto digitato a mano invece di una formula vale metà dei punti. Le attività su più celle valgono il punteggio pieno con il 100% delle celle giuste, metà dei punti dal 50%. Dove serve, cambiamo anche una cella di input su una copia del tuo foglio e controlliamo che la formula si aggiorni.
Risposte calcolate con le regole di Excel 365 e verificate nel nostro correttore in data 16 novembre 2026. Autore: GridBelt team.