Como usar a fórmula CHOOSE no Planilhas Google

We may already be aware of the usability of the nested IF statements and INTERRUPTORformulas 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 fórmula.

Sintaxe

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

  • índice – 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

Você também pode gostar...

Recursos e fórmulas do Google Sheets

Como encontrar a taxa de juros nominal usando o Planilhas Google

Sarah é uma jovem profissional que está tomando decisões financeiras importantes. De cartões de crédito a hipotecas, empréstimos estudantis e investimentos...
Recursos e fórmulas do Google Sheets

Extrair dados do Google Agenda para o Planilhas Google usando o Apps Script

Esta postagem foi publicada originalmente em nosso fórum da comunidade. Objetivo: Este guia demonstra como usar o Google Apps Script para extrair dados...
Recursos e fórmulas do Google Sheets

Usando a função PROPER para colocar a primeira letra de cada palavra em maiúscula no Planilhas Google

Observação: esta postagem foi publicada originalmente em nosso fórum da comunidade. Alguma vez você já precisou limpar uma lista de nomes, títulos ou qualquer...