Bird
Raised Fist0
Google Sheetsspreadsheet~20 mins

SORT and SORTN functions in Google Sheets - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
SORT and SORTN Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📊 Formula Result
intermediate
2:00remaining
Output of SORT with multiple columns
Given the data in range A1:C4:

A1: Name, B1: Age, C1: Score
A2: Alice, B2: 30, C2: 85
A3: Bob, B3: 25, C3: 90
A4: Carol, B4: 30, C4: 80

What is the output of the formula =SORT(A2:C4, 2, TRUE, 3, FALSE)?
A[["Bob", 25, 90], ["Alice", 30, 85], ["Carol", 30, 80]]
B[["Bob", 25, 90], ["Carol", 30, 80], ["Alice", 30, 85]]
C[["Alice", 30, 85], ["Carol", 30, 80], ["Bob", 25, 90]]
D[["Carol", 30, 80], ["Alice", 30, 85], ["Bob", 25, 90]]
Attempts:
2 left
💡 Hint
SORT sorts first by the first column you specify, then by the second column.
❓ Function Choice
intermediate
2:00remaining
Choosing between SORT and SORTN
You want to get the top 3 highest scores from a list of scores in column B (B2:B10). Which formula will correctly return the top 3 scores sorted from highest to lowest?
A=SORT(B2:B10, 1, TRUE)
B=SORTN(B2:B10, 3, 0, 1, FALSE)
C=SORTN(B2:B10, 3, 0, 1, TRUE)
D=SORT(B2:B10, 1, FALSE)
Attempts:
2 left
💡 Hint
SORTN can limit the number of results and sort order.
📊 Formula Result
advanced
2:30remaining
Result of SORTN with ties and unique option
Given the data in A1:B5:

A1: Name, B1: Score
A2: John, B2: 90
A3: Jane, B3: 85
A4: Joe, B4: 90
A5: Jill, B5: 80

What is the output of =SORTN(A2:B5, 2, 1, 2, FALSE)?

Note: The 3rd argument '1' means unique rows based on the sort column.
A[["Jane", 85], ["Jill", 80]]
B[["John", 90], ["Joe", 90]]
C[["John", 90], ["Jill", 80]]
D[["John", 90], ["Jane", 85]]
Attempts:
2 left
💡 Hint
Unique option removes duplicate scores when sorting.
🎯 Scenario
advanced
3:00remaining
Extracting top 5 salespeople by revenue with SORTN
You have a sales table in A1:C10:

A: Salesperson, B: Region, C: Revenue

You want to get the top 5 salespeople by Revenue, sorted descending, but only one salesperson per Region (no duplicates in Region). Which formula will achieve this?
A=SORTN(A2:C10, 5, 0, 3, FALSE)
B=SORTN(A2:C10, 5, 1, 2, FALSE)
C=SORTN(A2:C10, 5, 1, 3, FALSE)
D=SORTN(A2:C10, 5, 1, 1, FALSE)
Attempts:
2 left
💡 Hint
The 3rd argument '1' enforces unique rows based on the sort column. The 4th argument is the column to sort by.
❓ data_analysis
expert
3:00remaining
Analyzing SORTN output with multiple sort columns and unique option
Given the data in A1:D6:

A: Product, B: Category, C: Sales, D: Rating
A2: Pen, B2: Stationery, C2: 100, D2: 4.5
A3: Pencil, B3: Stationery, C3: 150, D3: 4.7
A4: Eraser, B4: Stationery, C4: 100, D4: 4.8
A5: Mug, B5: Kitchen, C5: 200, D5: 4.2
A6: Plate, B6: Kitchen, C6: 180, D6: 4.6

What is the output of:
=SORTN(A2:D6, 3, 1, 3, FALSE, 4, TRUE)

Note: The formula sorts first by Sales descending (column 3), then by Rating ascending (column 4), with unique rows based on the first sort column (Sales).
A[["Mug", "Kitchen", 200, 4.2], ["Pencil", "Stationery", 150, 4.7], ["Plate", "Kitchen", 180, 4.6]]
B]]6.4 ,081 ,"nehctiK" ,"etalP"[ ,]7.4 ,051 ,"yrenoitatS" ,"licneP"[ ,]2.4 ,002 ,"nehctiK" ,"guM"[[
C[["Mug", "Kitchen", 200, 4.2], ["Plate", "Kitchen", 180, 4.6], ["Pencil", "Stationery", 150, 4.7]]
D]]7.4 ,051 ,"yrenoitatS" ,"licneP"[ ,]6.4 ,081 ,"nehctiK" ,"etalP"[ ,]2.4 ,002 ,"nehctiK" ,"guM"[[
Attempts:
2 left
💡 Hint
Unique option keeps only one row per Sales value. Sorting is by Sales descending, then Rating ascending.

Practice

(1/5)
1. What does the SORT function do in Google Sheets?
easy
A. It arranges all data rows by one or more columns.
B. It picks only the top 3 rows from a data range.
C. It filters data based on a condition.
D. It sums up values in a column.

Solution

  1. Step 1: Understand the purpose of SORT

    The SORT function organizes data rows by sorting them according to one or more columns.
  2. Step 2: Compare with other functions

    Unlike functions that filter or sum data, SORT rearranges all rows based on column values.
  3. Final Answer:

    It arranges all data rows by one or more columns. -> Option A
  4. Quick Check:

    SORT = Arrange rows by column [OK]
Hint: SORT rearranges all rows by column values [OK]
Common Mistakes:
  • Confusing SORT with filtering functions
  • Thinking SORT picks only top rows
  • Assuming SORT sums values
2. Which of the following is the correct syntax for the SORTN function to get the top 5 rows sorted by column B ascending from range A1:C10?
easy
A. SORTN(A1:C10, 5, 0, 2, TRUE)
B. SORTN(A1:C10, 5, 0, 2, FALSE)
C. SORTN(A1:C10, 5, 1, 2, TRUE)
D. SORTN(A1:C10, 5, 0, 1, TRUE)

Solution

  1. Step 1: Identify SORTN parameters

    SORTN(range, n, display_ties_mode, sort_column, is_ascending) picks top n rows sorted by a column.
  2. Step 2: Match parameters to question

    We want top 5 rows (n=5), no tie display (0), sort by column 2 (B), ascending (TRUE).
  3. Final Answer:

    SORTN(A1:C10, 5, 0, 2, TRUE) -> Option A
  4. Quick Check:

    SORTN syntax with correct params [OK]
Hint: Remember SORTN(range, n, 0, col, TRUE) for top n ascending [OK]
Common Mistakes:
  • Using 1 instead of 0 for display_ties_mode
  • Sorting by wrong column number
  • Setting ascending to FALSE when ascending needed
3. Given the data in A1:B5:
A1:B5
1, 50
2, 40
3, 60
4, 30
5, 70
What is the result of =SORT(A1:B5, 2, TRUE)?
medium
A. [5, 70], [3, 60], [1, 50], [2, 40], [4, 30]
B. [4, 30], [1, 50], [2, 40], [3, 60], [5, 70]
C. [1, 50], [2, 40], [3, 60], [4, 30], [5, 70]
D. [4, 30], [2, 40], [1, 50], [3, 60], [5, 70]

Solution

  1. Step 1: Understand SORT parameters

    SORT(range, sort_column, is_ascending) sorts rows by the specified column ascending if TRUE.
  2. Step 2: Sort data by column 2 ascending

    Column 2 values: 50, 40, 60, 30, 70. Sorted ascending: 30, 40, 50, 60, 70. Corresponding rows: [4,30], [2,40], [1,50], [3,60], [5,70].
  3. Final Answer:

    [4, 30], [2, 40], [1, 50], [3, 60], [5, 70] -> Option D
  4. Quick Check:

    SORT by column 2 ascending = sorted rows [OK]
Hint: Sort by column values ascending to reorder rows [OK]
Common Mistakes:
  • Sorting by wrong column
  • Assuming descending order when TRUE means ascending
  • Mixing row order with original data
4. You wrote =SORTN(A1:A10, 3, 0, 2, TRUE) but it returns an error. What is the likely problem?
medium
A. The range A1:A10 has fewer than 3 rows.
B. The ascending parameter must be FALSE, not TRUE.
C. The sort column number 2 is outside the range columns.
D. The display_ties_mode parameter cannot be 0.

Solution

  1. Step 1: Check range and sort column

    The range A1:A10 has 1 column (A). Sort column 2 is outside the range columns, causing an error.
  2. Step 2: Rule out other options

    Fewer than 3 rows (A) returns available rows without error; TRUE (B) is valid for ascending; 0 (C) is valid for display_ties_mode.
  3. Final Answer:

    The sort column number 2 is outside the range columns. -> Option C
  4. Quick Check:

    Sort column must be within range columns [OK]
Hint: Check if sort column number fits range columns [OK]
Common Mistakes:
  • Using sort column number larger than columns in range
  • Confusing display_ties_mode values
  • Assuming TRUE must be FALSE for ascending
5. You have sales data in A2:C20 with columns: Product, Region, Sales. You want to find the top 3 sales amounts but only for the "East" region. Which formula correctly sorts and filters this data?
hard
A. =SORTN(A2:C20, 3, 0, 3, FALSE)
B. =SORTN(FILTER(A2:C20, B2:B20 = \"East\"), 3, 0, 3, FALSE)
C. =SORTN(FILTER(A2:C20, B2:B20 = \"East\"), 3, 0, 3, TRUE)
D. =SORT(FILTER(A2:C20, B2:B20 = \"East\"), 3, FALSE)

Solution

  1. Step 1: Filter data by region "East"

    Use FILTER(A2:C20, B2:B20 = "East") to get only rows where Region is East.
  2. Step 2: Use SORTN to get top 3 sales descending

    SORTN(filtered_data, 3, 0, 3, FALSE) picks top 3 rows sorted by Sales (column 3) descending (FALSE).
  3. Final Answer:

    =SORTN(FILTER(A2:C20, B2:B20 = "East"), 3, 0, 3, FALSE) -> Option B
  4. Quick Check:

    Filter then SORTN top 3 descending sales [OK]
Hint: Filter first, then SORTN top n descending [OK]
Common Mistakes:
  • Sorting ascending instead of descending
  • Not filtering before sorting
  • Using SORT instead of SORTN for top n
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard