Comment utiliser la formule COLUMNS dans Google Sheets ?

Let us say we have a range of cells in a spreadsheet, and we want to know how many columns it has spread across. If there are only a few of them, we could probably do a quick observation and manually count the number. But there can be instances where columns in a range are more than just a few. Or we may need to generate the output dynamically, rather than relying upon manual observation. In such scenarios, the appropriately named COLUMNS formula in Google Sheets can help us.

Syntaxe

COLUMNS(range)

  • gamme – is the range of values, or the address reference to the range of cells, whose column count the formula returns.

Usage: COLUMNS formula in Google Sheets

As such, the syntax of the formula is pretty straightforward. But going through a few practical examples reinforces our understanding. So, without further ado, let us dive right in. Please have a look at the snapshot below.

COLUMNS Formula in Google Sheets

In order for us to input values directly as a range, we need to use a pair of curly brackets. We illustrated this in the first example. How do we specify the columns and rows in such a range? It is simple, really. While we separate the values into columns using a comma, we use a semi-colon to separate the values into rows. And if we observe closely, the range {62,72,52;81,87,73} consists of two rows and three columns. Therefore the formula returned the output as 3.

In the second example, we used the reference to the range of cells instead of inputting the values directly. The range B2:D3 also spans across two rows and three columns. Hence it evaluates the output to 3, just like the formula in the first example did.

Regardless of the number of rows within the range, the COLUMNS formula returns only the number of columns within that range. The range B2:D2 used in the third example has just one row, but that doesn’t impact the output. That is because there are three columns from B through D.

The fourth example shows just another range, that consists of four columns. Hence the formula returns 4 as output.

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...