Aller au contenu
GridBelt
  • Test Excel
  • Exercices
  • Programmes
  • Tarifs
Se connecter
Commencer le test gratuit
  • Test Excel
  • Exercices
  • Programmes
  • Tarifs
Se connecterCréer un compte
Commencer le test gratuit
GridBelt

Entraînez-vous sur Excel dans votre navigateur.

Test Excel

  • Niveau 1 : Débutant
  • Niveau 2 : Intermédiaire
  • Niveau 3 : Expert
  • Test Excel en 7 jours
  • Classement
  • Test Excel en entretien d’embauche
  • Évaluation Excel d’Indeed

Exercices

  • Tous les exercices
  • Programmes
  • Pour débutants

Guides

  • Formules Excel
  • Raccourcis Excel

Entreprise

  • À propos
  • Tarifs
  • Comment nous corrigeons

© GridBelt. Tous droits réservés.

  • Politique de confidentialité
  • Conditions d’utilisation
  • Politique de remboursement

Excel est une marque commerciale de Microsoft Corporation. Indeed, TestGorilla, SHL et les autres marques sont la propriété de leurs détenteurs respectifs. GridBelt est un site d’entraînement indépendant ; il n’est affilié ni à Microsoft, ni à TestGorilla, ni à SHL, ni à Indeed, et n’est ni cautionné ni sponsorisé par ces sociétés.

  1. Exercices
  2. /
  3. Pivot tables

GROUPBY practice: tickets per agent with a filter, largest first

  • Expert
  • ~9 min
  • Pivot tables
  • Excel 365

Énoncé en anglais

The service desk logged 220 tickets in October 2026 (A2:D221): ticket ID, opening date, the agent who handled it and its priority — Low, Normal, High or Urgent. The team lead wants the PivotTable she would build in Excel: Priority as the report filter set to High, Agent in Rows, Count of Ticket ID in Values, no grand total, and the busiest agent on top. This practice grid has no PivotTable command, so you build the report with one GROUPBY formula instead: the filter value sits in G1 and the report starts in F4, under the headings in F3:G3.

Ce que vous devez faire

  1. 1G1 is the report filter (Priority = High), like the Filters area above a PivotTable. Click F4, where the report starts.
  2. 2Start with the counting part: GROUPBY(C2:C221,A2:A221,COUNTA, … — the agents are the row field, the ticket IDs are the values and COUNTA counts them, which is a PivotTable's "Count of Ticket ID". COUNT would return 0 for every agent, because ticket IDs are text.
  3. 3Add the optional arguments in their order: field_headers 0 (the ranges have no header row), total_depth 0 (no Total row), sort_order 1 (A to Z for now) and filter_array D2:D221=G1 (only the rows whose priority equals G1): =GROUPBY(C2:C221,A2:A221,COUNTA,0,0,1,D2:D221=G1).
  4. 4Sort by the count, largest first, by wrapping it in SORT: =SORT(GROUPBY(C2:C221,A2:A221,COUNTA,0,0,1,D2:D221=G1),2,-1) — column 2 of the result, -1 for descending. Excel 365 can also sort inside GROUPBY with sort_order -2, but this practice grid ignores the column number in sort_order, so use SORT here; it works the same in Excel.
  5. 5Press Enter and keep the cells below and to the right of F4 empty, or the result shows #SPILL!. Type the 0 for total_depth rather than leaving it empty: in Excel an empty argument means "automatic", which brings the Total row back.
  6. 6Try the filter: change G1 to Urgent and watch the report re-rank itself, then put High back and click Check.

Cellules de réponse

Correction

Saisissez votre formule dans la grille, appuyez sur Enter, puis cliquez sur Vérifier. Nous corrigeons la valeur de chaque cellule de réponse et la formule qui la produit.

Tâches

  1. Non vérifiéIn F4, write one formula with GROUPBY that counts the tickets (the ticket IDs in A2:A221) per agent (C2:C221) for the priority in G1 only, with no total row, sorted by the count from largest to smallest.

Ordinateur recommandé pour les tâches dans la feuille de calcul. La feuille défile à l’intérieur de ce cadre.

StartInsertFormulasDataView
A1fxPréparation de votre classeur…
A
B
C
D
E
F
G
H
I
J
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Sheet1

Saisissez votre formule dans la feuille, puis vérifiez.

À propos de cet exercice

Un jeu de données de 220 lignes sur une feuille, une cellule de réponse, environ 9 minutes. Corrigé dans votre navigateur : la valeur et la formule qui la produit, avec des indications sur la correction à apporter.

Comment le résoudre

  • F4=SORT(GROUPBY(C2:C221,A2:A221,COUNTA,0,0,1,D2:D221=G1),2,-1)

Each optional argument of GROUPBY is a PivotTable setting: COUNTA as the function is "Count of Ticket ID", total_depth 0 switches the grand total off, and filter_array D2:D221=G1 is the report filter — only the rows whose priority matches G1 take part. SORT(…,2,-1) then does what "Sort Largest to Smallest" does on the count column. Because the filter value lives in a cell, typing another priority into G1 re-filters and re-ranks the whole report at once.

The PivotTable route in Excel: Priority to Filters (pick High), Agent to Rows, Ticket ID to Values (a text field is counted: "Count of Ticket ID"), Design → Grand Totals → Off for Rows and Columns, then right-click a count → Sort → Sort Largest to Smallest. Pitfall 1: sorting a GROUPBY that still has its Total row sorts the Total in with the agents — it lands on top. Switch the totals off first (total_depth 0) or drop them with DROP(…,-1). Pitfall 2: an empty argument is not a zero. In Excel, GROUPBY(…,COUNTA,0,,…) means "automatic" totals and shows the Total row; type the 0. Pitfall 3: COUNT counts numbers only, so it returns 0 for text IDs; COUNTA counts every non-empty value. Pitfall 4: ties. In this grid SORT keeps tied rows in the order GROUPBY gave them (A to Z); if the order of ties matters, give SORTBY a second key, e.g. =LET(g,GROUPBY(C2:C221,A2:A221,COUNTA,0,0,1,D2:D221=G1),SORTBY(g,CHOOSECOLS(g,2),-1,CHOOSECOLS(g,1),1)). Excel 365 can also sort inside GROUPBY: =GROUPBY(C2:C221,A2:A221,COUNTA,0,0,-2,D2:D221=G1) sorts by the 2nd column descending there, while this practice grid ignores the column number and sorts the names Z to A. Several conditions combine with *: (D2:D221=G1)*(B2:B221>=DATE(2026,10,15)). GROUPBY needs Excel for Microsoft 365.

Autres méthodes valables

  • =SORT(GROUPBY(FILTER(C2:C221,D2:D221=G1),FILTER(A2:A221,D2:D221=G1),COUNTA,0,0),2,-1) — filter the rows first, then group
  • =LET(g,GROUPBY(C2:C221,A2:A221,COUNTA,0,0,1,D2:D221=G1),SORTBY(g,CHOOSECOLS(g,2),-1)) — SORTBY on the count column
  • =GROUPBY(C2:C221,A2:A221,COUNTA,0,0,-2,D2:D221=G1) — Excel 365 only: sorts by the count inside GROUPBY (this practice grid ignores the column number in sort_order)

Erreurs fréquentes

Counting with COUNT instead of COUNTA: the ticket IDs are text, so every agent shows 0 and the ranking is meaningless; a PivotTable's "Count" of a text field is COUNTA.

Comment nous corrigeons

Toute formule qui produit le bon résultat est acceptée, sauf si la tâche nomme une fonction : une autre fonction rapporte alors la moitié des points. Nous comparons les valeurs avec une petite tolérance et ignorons la casse et les espaces dans le texte. Un nombre correct saisi à la main au lieu d’une formule rapporte la moitié des points. Les tâches sur plusieurs cellules rapportent tous les points avec 100 % de cellules justes, la moitié à partir de 50 %. Lorsque c’est pertinent, nous modifions aussi une cellule d’entrée sur une copie de votre feuille et vérifions que votre formule suit.

Réponses calculées selon les règles d’Excel 365 et vérifiées dans notre correcteur le 20 novembre 2026. Auteur : GridBelt team.

Dans ces programmes

  • Excel test in 7 days, Plan de niveau 3Jour 6
  • Excel for Data AnalystsJour 8

Exercices associés

  • A pivot-style sales report by region with GROUPBYIntermédiaire, ~6 min
  • Products ranked by sales with SORTBYExpert, ~8 min
  • Orders per region and month with COUNTIFSIntermédiaire, ~7 min

Référence de la fonction

Documentation officielle

Exercice suivant

Share of revenue by channel: % of Grand Total with formulas