Comment utiliser la formule CHOOSE dans Google Sheets ?

We may already be aware of the usability of the nested IF statements and INTERRUPTEURformulas in Google Sheets. Going by the experience, we can conclude that the SWITCH formula is less complicated than that of the nested IF statement. On the similar lines, wouldn’t it be nice if instead of specifying the case every time, we just specify an index of sorts, and we get the corresponding value? Well, just to help us with that purpose, the Google Sheets application hosts the CHOOSE formule.

Syntaxe

CHOOSE(index, choice1, [choice2, …])

  • index – this specifies the choice number. If it is 1, the CHOOSE formula returns the choice1. Similarly, if it is 3, we get choice3 in return. Please note that the Google Sheets allows up to 30 index values, starting from 1.
  • choice1 – the formula returns this when the index value is 1. It can be a simple text, number, reference to another cell, or even a full-fledged formula.
  • choice2 – additional and optional parameters similar to that of choice1.

Usage: CHOOSE Formula

Let us start with the basic example that returns the weekday based on the index number. In the snapshot below, you can see the various combinations of the formula that we tried.

CHOOSE formula 1

Like we mentioned above, the range of the index values can only start from 1 and can’t exceed the total number of choices within the formula. What happens if we try to force that? It coughs up errors of course! Let us try that firsthand. Below is the snapshot that demonstrates the outcome of using the index value 0.

CHOOSE formula 2

Does the behavior change when we exceed the number of choices (in this case 3)? As it turns out, not really.

CHOOSE formula 3

Similar is the case when the index number is either a negative number.

CHOOSE formula 4

What happens if the index is a decimal number? Surprisingly, it doesn’t error out this time. The CHOOSE formula considers the value on the left of the decimal point (in this case 2) and evaluates the formula accordingly.

CHOOSE formula 5

Vous pouvez aussi aimer...

Fonctionnalités et formules de google sheets

Comment calculer le taux d'intérêt nominal à l'aide de Google Sheets ?

Sarah est une jeune professionnelle qui doit prendre des décisions financières importantes. Des cartes de crédit aux hypothèques, en passant par les prêts étudiants et les...
Fonctionnalités et formules de google sheets

Extraire les données de Google Calendar dans Google Sheets à l'aide d'Apps Script

Cet article a été publié à l'origine dans notre forum communautaire. Objectif : Ce guide montre comment utiliser Google Apps Script pour extraire des données...
Fonctionnalités et formules de google sheets

Utilisation de la fonction PROPER pour mettre en majuscule la première lettre de chaque mot dans Google Sheets

Note : Cet article a été publié à l'origine dans notre forum communautaire. Vous avez déjà eu besoin de nettoyer une liste de noms, de titres ou d'autres...