ExcelFormulas logoExcelFormulas.
Chiedi all'IA
LogicheVerificato da QA

SWITCH.

Evaluates an expression against a list of values and returns the matching result.

Logiche
ExcelExcel 365Excel 2021Excel 2019Google Sheets

Come funziona nel dettaglio.

SWITCH è una funzione fondamentale di Excel. Evaluates an expression against a list of values and returns the matching result. Consente di velocizzare la gestione dei fogli di calcolo, ridurre gli errori e creare report automatizzati professionali.

Sintassi.

Notazione Ufficiale Excel
=SWITCH(expression, val1, result1, [default])
Consiglio: Gli argomenti tra parentesi quadre [come_questo] sono facoltativi; tutti gli altri sono obbligatori.

Argomenti.

Di seguito l'elenco dettagliato di tutti i parametri accettati da questa funzione.

expressionObbligatorio

The value to evaluate.

Valore d'esempio: A2
val1Obbligatorio

First value to test for equality.

Valore d'esempio: 1
result1Obbligatorio

Output returned if expression matches val1.

Valore d'esempio: "Sunday"

Esempio pratico.

Scenario di utilizzo

Day Number to Name Mapping

Convert numeric day codes into weekday names.

Day CodeWeekday Name
2—
1—
3—
Formula applicata
=SWITCH(A2, 1, "Sunday", 2, "Monday", 3, "Tuesday", "Other")
Risultato atteso::Monday

Evaluates SWITCH over the sample table cells, placing the verified output in cell B2.

Generatore di formula.

Apri Procedura Guidata Completa

Compila i campi qui sotto per creare una formula personalizzata pronta da incollare nel tuo foglio di calcolo.

Generated FormulaPronta da copiare

Caratteristiche del risultato.

Returns "Monday" based on sample evaluation criteria and active cell references.

Esempio di output::Monday
Tipo di dato restituito::Text

Migliori Pratiche

  • Always specify an optional default value at the end to catch unanticipated inputs.

Errori Più Frequenti

  • If no value matches and no default argument is provided, SWITCH returns #N/A.
Matrice di Compatibilità

Compatibilità per programma e versione.

Verifica tecnica eseguita sui motori di calcolo ufficiali di Microsoft Excel e Google Fogli.

Excel✓
Supportato
Excel 365✓
Supportato
Excel 2021✓
Supportato
Excel 2019✓
Supportato
Google Sheets✓
Supportato
Disponibilità e versioni di Excel

Introduced in Excel 2019 and Excel 365. Supported in Excel 2019, 2021, and 365.

Note su Google Fogli

100% compatible with Google Sheets with identical expression evaluation rules.

Domande frequenti.

Domande Tecniche
Can 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.