Fonctionnement détaillé.
SWITCH est une fonction indispensable d'Excel. Evaluates an expression against a list of values and returns the matching result. Elle permet d'automatiser vos tableaux, fiabiliser vos calculs et gagner un temps précieux au quotidien dans vos feuilles de calcul.
Syntaxe.
Notation Standard Excel=SWITCH(expression, val1, result1, [default])Arguments.
Détail de l'ensemble des paramètres acceptés par cette fonction.
The value to evaluate.
Exemple :A2First value to test for equality.
Exemple :1Output returned if expression matches val1.
Exemple :"Sunday"Exemple pas à pas.
Cas d'usage concretDay Number to Name Mapping
Convert numeric day codes into weekday names.
| Day Code | Weekday Name |
|---|---|
| 2 | — |
| 1 | — |
| 3 | — |
=SWITCH(A2, 1, "Sunday", 2, "Monday", 3, "Tuesday", "Other")Evaluates SWITCH over the sample table cells, placing the verified output in cell B2.
Générateur de formule.
Ouvrir l'assistant completPersonnalisez les champs ci-dessous pour générer une formule prête à être copiée dans votre classeur.
=SWITCH()Nature du résultat produit.
Returns "Monday" based on sample evaluation criteria and active cell references.
Bonnes Pratiques
- Always specify an optional default value at the end to catch unanticipated inputs.
Erreurs à Éviter
- If no value matches and no default argument is provided, SWITCH returns #N/A.
Compatibilité par logiciel et version.
Vérification effectuée selon les moteurs de calcul officiels de Microsoft et Google.
In Excel 2016 or older, use nested IFs or the CHOOSE function.
Introduced in Excel 2019 and Excel 365. Supported in Excel 2019, 2021, and 365.
100% compatible with Google Sheets with identical expression evaluation rules.
Questions fréquentes.
Questions TechniquesCan I use SWITCH across different worksheets in Excel?↓
Yes. You can reference cells located on other sheets by including the sheet name followed by an exclamation mark, for example: =SWITCH(Sheet2!A2:A10). If the sheet name contains spaces, enclose it in single quotes: ='Q1 Report'!A2:A10.
What is the most common reason for errors in SWITCH?↓
If no value matches and no default argument is provided, SWITCH returns #N/A.
Does SWITCH work identically in Google Sheets?↓
Yes, SWITCH is supported in both Microsoft Excel and Google Sheets with standard evaluation behavior.