← All functions

SORTN

Unsupported (not recognized)

Category: Filter · Last tested 2026-09-01

Real compatibility results for the SORTN function: executed in Excel for the web, Google Sheets and LibreOffice Calc, measured against Google’s published documentation. Excel does not document SORTN, so this page makes no claim about Excel. Syntax and links to that documentation are below.

Support matrix

EngineDocumentedLive-testedVerdict
Excel (desktop)No n/a (not an Excel function) n/a
Excel for the web— Yes (recalc, 2026-09-01) Unsupported (not recognized)
Google SheetsYes Yes (Drive import, 2026-09-01) Supported, behaves as documented
LibreOffice CalcNo Yes (25.8.7.3, 2026-09-01) Unsupported (not recognized)

LibreOffice version history

We executed the same test cases under each LibreOffice release to show exactly when SORTN’s support changed — not documentation claims, real results.

LibreOffice versionVerdictTested
24.2.0.3 Unsupported (not recognized) 2026-09-01
24.8.7.2 Unsupported (not recognized) 2026-09-01
25.2.0.3 Unsupported (not recognized) 2026-09-01
25.8.7.3 Unsupported (not recognized) 2026-09-01

Why isn't SORTN working in LibreOffice?

LibreOffice Calc does not implement SORTN as of 25.8.7.3 — in our executed tests it returns a #NAME? (unrecognized function) error. This is not a typo or a settings problem, and saving the file as .xlsx does not change it: the function simply isn’t available yet. Watch the LibreOffice version support page — we re-run every test on each new release, so it will flip to Supported here as soon as it lands.

Discovered quirks

Executed test cases

Excel for the web (executed 2026-09-01 via OneDrive recalculation)

These values come from Excel for the web, not from desktop Excel. They are two different implementations of the calculation engine, and this run measured only the web one: the corpus was uploaded to OneDrive as .xlsx, recalculated by Excel for the web on open, and downloaded again for readback. Excel for the web is a rolling service with no pinnable version, so the run is identified by its date. Where a value here disagrees with the Expected column — which is Microsoft’s documentation of the desktop product — we cannot tell you whether the web engine diverges from the desktop one or the documentation is wrong about both, because we do not run desktop Excel.

FormulaDescriptionResultExpectedVerdict
=SORTN(A2:C6) Published row 1: every optional argument defaulted {#NAME?, #NAME?, #NAME?} {{Alice, 100, 90}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: =SORTN(A2:C6) -> Alice 100 90. Two defaults are doing the work and the page states both: n is "[OPTIONAL - 1 by default]", and the Notes say "If sort_column1 and is_ascending1 aren't included, the sort is performed on the lowest-index column in range" -- column A, the names, ascending, where Alice sorts first. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. SORTN's page carries a real Examples block in the article body: a source table ("The following table is used for the examples below") of five students with two scores each, and seven Formula/Result rows over it. This file executes all seven, on that exact data. EVERY EXPECTED VALUE HERE IS GOOGLE'S OWN PUBLISHED OUTPUT, and each was additionally re-derived by hand from the display_ties_mode definitions before being written down; all seven reproduce. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624. BATCH PROVENANCE (batch H, the first Sheets/LibreOffice-only batch). Every function in this batch has x == false in docs/data/compat.json: it is a Google Sheets function that Microsoft does not document at all, so this corpus makes NO claim about it in that engine and nothing here is measured against that vendor's documentation. The authority is Google's own support.google.com function page, cited by full URL and by the date it was read -- Google publishes no version number for these pages, so a bare URL dates nothing. WHAT GOOGLE ACTUALLY PRINTS, WHICH IS LESS THAN IT LOOKS: most of these pages carry a 'Sample Usage' block of FORMULAS WITH NO RESULTS. Where a value below is Google's own published output the note says so; where it is derived from the page's stated semantics the note says that instead, and says from which sentence. No value in this batch was taken from a search snippet, a blog or a mirror. LIBREOFFICE: probed on all four pinned builds (24.2.0.3, 24.8.7.2, 25.2.0.3, 25.8.7.3) in five storage spellings -- plain, _xlfn., COM.MICROSOFT., ORG.OPENOFFICE. and _xlfn.ORG.OPENOFFICE. -- and #NAME? under every one of them, so the expected values below describe Google Sheets and the LibreOffice column records absence.

Mismatch
=SORTN(A2:C6, 2) Published row 2: n given, sort still defaulted {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Alice, 100, 90}, {Bob, 75, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Bob 75 85. Still sorted by the name column, so the two lowest names come back regardless of score. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch
=SORTN(A2:C6, 3, 0, B2:B6, FALSE) Published row 3: ties mode 0, sorted by Test 1 score descending {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Alice, 100, 90}, {Devon, 100, 95}, {Carol, 80, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Devon 100 95 / Carol 80 85. Mode 0 is "Show at most the first n rows in the sorted range", so the tie between Alice and Devon at 100 is simply truncated at three rows and Eloise, also on 80, is cut off. The relative order within a tie follows the source, which the Notes support: "range is sorted only by the specified columns. Other columns are returned in the order they originally appear." ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch
=SORTN(A2:C6, 3, 1, B2:B6, FALSE) Published row 4: ties mode 1 pulls in a fourth row {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Alice, 100, 90}, {Devon, 100, 95}, {Carol, 80, 85}, {Eloise, 80, 90}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Devon 100 95 / Carol 80 85 / Eloise 80 90. Mode 1 is "Show at most the first n rows, plus any additional rows that are identical to the nth row". The nth row is Carol; Eloise is NOT identical to Carol as a row (85 against 90 on Test 2) but ties her on the sort column, and the published output includes her. A NOTE THE PAGE NEEDS AND DOES NOT HAVE: its display_ties_mode wording talks about "rows that are identical to the nth row" and "removing duplicate rows", but no two rows in its own example data are identical -- Alice and Devon share only their Test 1 score, as do Carol and Eloise. The published outputs are only consistent with "identical" and "duplicate" meaning EQUAL IN THE SORT COLUMN OR COLUMNS, not equal as whole rows. That reading is recorded here because it is derived from Google's results rather than stated in Google's prose. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch
=SORTN(A2:C6, 3, 2, B2:B6, FALSE) Published row 5: ties mode 2 drops rows the other modes keep {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Alice, 100, 90}, {Carol, 80, 85}, {Bob, 75, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Carol 80 85 / Bob 75 85. Mode 2 is "Show at most the first n rows after removing duplicate rows", and this is the row that proves "duplicate" cannot mean what it says: no two rows in the data are identical, yet Devon and Eloise are both removed. They are the second row at each of the tied scores 100 and 80. A NOTE THE PAGE NEEDS AND DOES NOT HAVE: its display_ties_mode wording talks about "rows that are identical to the nth row" and "removing duplicate rows", but no two rows in its own example data are identical -- Alice and Devon share only their Test 1 score, as do Carol and Eloise. The published outputs are only consistent with "identical" and "duplicate" meaning EQUAL IN THE SORT COLUMN OR COLUMNS, not equal as whole rows. That reading is recorded here because it is derived from Google's results rather than stated in Google's prose. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch
=SORTN(A2:C6, 3, 3, B2:B6, FALSE) Published row 6: ties mode 3 returns five rows for n = 3 {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Alice, 100, 90}, {Devon, 100, 95}, {Carol, 80, 85}, {Eloise, 80, 90}, {Bob, 75, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: all five students come back. Mode 3 is "Show at most the first n unique rows, but show every duplicate of these rows": the three distinct Test 1 scores are 100, 80 and 75, and every row carrying one of them is returned. It is the clearest demonstration that n counts DISTINCT SORT KEYS in this mode, not output rows. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch
=SORTN(A2:C6, 3, 3, 2, FALSE, 3, FALSE) Published row 7: two sort columns given as indices rather than ranges {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Devon, 100, 95}, {Alice, 100, 90}, {Eloise, 80, 90}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Devon 100 95 / Alice 100 90 / Eloise 80 90. This row looks malformed beside the others and is not: sort_column1 is documented as "the INDEX of the column in range or a range outside of range", so the bare 2 and 3 are column indices, each followed by its own is_ascending flag. Sorting descending by Test 1 then by Test 2 orders Devon (100,95) ahead of Alice (100,90) -- reversing them relative to every other row in the table, which is what makes this the one case that proves the second sort key is honoured. Mode 3 then counts DISTINCT COMBINED SORT KEYS, not distinct Test 1 scores: the pairs (100,95), (100,90) and (80,90) are the first three, none of them duplicated, so exactly three rows come back -- where the single-column mode-3 row above returned all five. That refinement is derived from this published output; the page never says uniqueness is measured over the whole set of sort columns. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch

Google Sheets (executed 2026-09-01 via Drive import)

Google Sheets is a rolling service with no pinnable version, so this run is identified by its date. The corpus was imported to Drive as .xlsx, recalculated by Sheets, and exported back for readback.

FormulaDescriptionResultExpectedVerdict
=SORTN(A2:C6) Published row 1: every optional argument defaulted {Alice, 100, 90} {{Alice, 100, 90}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: =SORTN(A2:C6) -> Alice 100 90. Two defaults are doing the work and the page states both: n is "[OPTIONAL - 1 by default]", and the Notes say "If sort_column1 and is_ascending1 aren't included, the sort is performed on the lowest-index column in range" -- column A, the names, ascending, where Alice sorts first. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. SORTN's page carries a real Examples block in the article body: a source table ("The following table is used for the examples below") of five students with two scores each, and seven Formula/Result rows over it. This file executes all seven, on that exact data. EVERY EXPECTED VALUE HERE IS GOOGLE'S OWN PUBLISHED OUTPUT, and each was additionally re-derived by hand from the display_ties_mode definitions before being written down; all seven reproduce. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624. BATCH PROVENANCE (batch H, the first Sheets/LibreOffice-only batch). Every function in this batch has x == false in docs/data/compat.json: it is a Google Sheets function that Microsoft does not document at all, so this corpus makes NO claim about it in that engine and nothing here is measured against that vendor's documentation. The authority is Google's own support.google.com function page, cited by full URL and by the date it was read -- Google publishes no version number for these pages, so a bare URL dates nothing. WHAT GOOGLE ACTUALLY PRINTS, WHICH IS LESS THAN IT LOOKS: most of these pages carry a 'Sample Usage' block of FORMULAS WITH NO RESULTS. Where a value below is Google's own published output the note says so; where it is derived from the page's stated semantics the note says that instead, and says from which sentence. No value in this batch was taken from a search snippet, a blog or a mirror. LIBREOFFICE: probed on all four pinned builds (24.2.0.3, 24.8.7.2, 25.2.0.3, 25.8.7.3) in five storage spellings -- plain, _xlfn., COM.MICROSOFT., ORG.OPENOFFICE. and _xlfn.ORG.OPENOFFICE. -- and #NAME? under every one of them, so the expected values below describe Google Sheets and the LibreOffice column records absence.

Matched
=SORTN(A2:C6, 2) Published row 2: n given, sort still defaulted {Alice, 100, 90, Bob, 75, 85} {{Alice, 100, 90}, {Bob, 75, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Bob 75 85. Still sorted by the name column, so the two lowest names come back regardless of score. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Matched
=SORTN(A2:C6, 3, 0, B2:B6, FALSE) Published row 3: ties mode 0, sorted by Test 1 score descending {Alice, 100, 90, Devon, 100, 95, Carol, 80, 85} {{Alice, 100, 90}, {Devon, 100, 95}, {Carol, 80, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Devon 100 95 / Carol 80 85. Mode 0 is "Show at most the first n rows in the sorted range", so the tie between Alice and Devon at 100 is simply truncated at three rows and Eloise, also on 80, is cut off. The relative order within a tie follows the source, which the Notes support: "range is sorted only by the specified columns. Other columns are returned in the order they originally appear." ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Matched
=SORTN(A2:C6, 3, 1, B2:B6, FALSE) Published row 4: ties mode 1 pulls in a fourth row {Alice, 100, 90, Devon, 100, 95, Carol, 80, 85, Eloise, 80, 90} {{Alice, 100, 90}, {Devon, 100, 95}, {Carol, 80, 85}, {Eloise, 80, 90}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Devon 100 95 / Carol 80 85 / Eloise 80 90. Mode 1 is "Show at most the first n rows, plus any additional rows that are identical to the nth row". The nth row is Carol; Eloise is NOT identical to Carol as a row (85 against 90 on Test 2) but ties her on the sort column, and the published output includes her. A NOTE THE PAGE NEEDS AND DOES NOT HAVE: its display_ties_mode wording talks about "rows that are identical to the nth row" and "removing duplicate rows", but no two rows in its own example data are identical -- Alice and Devon share only their Test 1 score, as do Carol and Eloise. The published outputs are only consistent with "identical" and "duplicate" meaning EQUAL IN THE SORT COLUMN OR COLUMNS, not equal as whole rows. That reading is recorded here because it is derived from Google's results rather than stated in Google's prose. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Matched
=SORTN(A2:C6, 3, 2, B2:B6, FALSE) Published row 5: ties mode 2 drops rows the other modes keep {Alice, 100, 90, Carol, 80, 85, Bob, 75, 85} {{Alice, 100, 90}, {Carol, 80, 85}, {Bob, 75, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Carol 80 85 / Bob 75 85. Mode 2 is "Show at most the first n rows after removing duplicate rows", and this is the row that proves "duplicate" cannot mean what it says: no two rows in the data are identical, yet Devon and Eloise are both removed. They are the second row at each of the tied scores 100 and 80. A NOTE THE PAGE NEEDS AND DOES NOT HAVE: its display_ties_mode wording talks about "rows that are identical to the nth row" and "removing duplicate rows", but no two rows in its own example data are identical -- Alice and Devon share only their Test 1 score, as do Carol and Eloise. The published outputs are only consistent with "identical" and "duplicate" meaning EQUAL IN THE SORT COLUMN OR COLUMNS, not equal as whole rows. That reading is recorded here because it is derived from Google's results rather than stated in Google's prose. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Matched
=SORTN(A2:C6, 3, 3, B2:B6, FALSE) Published row 6: ties mode 3 returns five rows for n = 3 {Alice, 100, 90, Devon, 100, 95, Carol, 80, 85, Eloise, 80, 90, Bob, 75, 85} {{Alice, 100, 90}, {Devon, 100, 95}, {Carol, 80, 85}, {Eloise, 80, 90}, {Bob, 75, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: all five students come back. Mode 3 is "Show at most the first n unique rows, but show every duplicate of these rows": the three distinct Test 1 scores are 100, 80 and 75, and every row carrying one of them is returned. It is the clearest demonstration that n counts DISTINCT SORT KEYS in this mode, not output rows. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Matched
=SORTN(A2:C6, 3, 3, 2, FALSE, 3, FALSE) Published row 7: two sort columns given as indices rather than ranges {Devon, 100, 95, Alice, 100, 90, Eloise, 80, 90} {{Devon, 100, 95}, {Alice, 100, 90}, {Eloise, 80, 90}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Devon 100 95 / Alice 100 90 / Eloise 80 90. This row looks malformed beside the others and is not: sort_column1 is documented as "the INDEX of the column in range or a range outside of range", so the bare 2 and 3 are column indices, each followed by its own is_ascending flag. Sorting descending by Test 1 then by Test 2 orders Devon (100,95) ahead of Alice (100,90) -- reversing them relative to every other row in the table, which is what makes this the one case that proves the second sort key is honoured. Mode 3 then counts DISTINCT COMBINED SORT KEYS, not distinct Test 1 scores: the pairs (100,95), (100,90) and (80,90) are the first three, none of them duplicated, so exactly three rows come back -- where the single-column mode-3 row above returned all five. That refinement is derived from this published output; the page never says uniqueness is measured over the whole set of sort columns. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Matched

LibreOffice Calc 25.8.7.3 (tested 2026-09-01)

FormulaDescriptionResultExpectedVerdict
=SORTN(A2:C6) Published row 1: every optional argument defaulted {#NAME?, #NAME?, #NAME?} {{Alice, 100, 90}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: =SORTN(A2:C6) -> Alice 100 90. Two defaults are doing the work and the page states both: n is "[OPTIONAL - 1 by default]", and the Notes say "If sort_column1 and is_ascending1 aren't included, the sort is performed on the lowest-index column in range" -- column A, the names, ascending, where Alice sorts first. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. SORTN's page carries a real Examples block in the article body: a source table ("The following table is used for the examples below") of five students with two scores each, and seven Formula/Result rows over it. This file executes all seven, on that exact data. EVERY EXPECTED VALUE HERE IS GOOGLE'S OWN PUBLISHED OUTPUT, and each was additionally re-derived by hand from the display_ties_mode definitions before being written down; all seven reproduce. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624. BATCH PROVENANCE (batch H, the first Sheets/LibreOffice-only batch). Every function in this batch has x == false in docs/data/compat.json: it is a Google Sheets function that Microsoft does not document at all, so this corpus makes NO claim about it in that engine and nothing here is measured against that vendor's documentation. The authority is Google's own support.google.com function page, cited by full URL and by the date it was read -- Google publishes no version number for these pages, so a bare URL dates nothing. WHAT GOOGLE ACTUALLY PRINTS, WHICH IS LESS THAN IT LOOKS: most of these pages carry a 'Sample Usage' block of FORMULAS WITH NO RESULTS. Where a value below is Google's own published output the note says so; where it is derived from the page's stated semantics the note says that instead, and says from which sentence. No value in this batch was taken from a search snippet, a blog or a mirror. LIBREOFFICE: probed on all four pinned builds (24.2.0.3, 24.8.7.2, 25.2.0.3, 25.8.7.3) in five storage spellings -- plain, _xlfn., COM.MICROSOFT., ORG.OPENOFFICE. and _xlfn.ORG.OPENOFFICE. -- and #NAME? under every one of them, so the expected values below describe Google Sheets and the LibreOffice column records absence.

Mismatch
=SORTN(A2:C6, 2) Published row 2: n given, sort still defaulted {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Alice, 100, 90}, {Bob, 75, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Bob 75 85. Still sorted by the name column, so the two lowest names come back regardless of score. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch
=SORTN(A2:C6, 3, 0, B2:B6, FALSE) Published row 3: ties mode 0, sorted by Test 1 score descending {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Alice, 100, 90}, {Devon, 100, 95}, {Carol, 80, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Devon 100 95 / Carol 80 85. Mode 0 is "Show at most the first n rows in the sorted range", so the tie between Alice and Devon at 100 is simply truncated at three rows and Eloise, also on 80, is cut off. The relative order within a tie follows the source, which the Notes support: "range is sorted only by the specified columns. Other columns are returned in the order they originally appear." ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch
=SORTN(A2:C6, 3, 1, B2:B6, FALSE) Published row 4: ties mode 1 pulls in a fourth row {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Alice, 100, 90}, {Devon, 100, 95}, {Carol, 80, 85}, {Eloise, 80, 90}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Devon 100 95 / Carol 80 85 / Eloise 80 90. Mode 1 is "Show at most the first n rows, plus any additional rows that are identical to the nth row". The nth row is Carol; Eloise is NOT identical to Carol as a row (85 against 90 on Test 2) but ties her on the sort column, and the published output includes her. A NOTE THE PAGE NEEDS AND DOES NOT HAVE: its display_ties_mode wording talks about "rows that are identical to the nth row" and "removing duplicate rows", but no two rows in its own example data are identical -- Alice and Devon share only their Test 1 score, as do Carol and Eloise. The published outputs are only consistent with "identical" and "duplicate" meaning EQUAL IN THE SORT COLUMN OR COLUMNS, not equal as whole rows. That reading is recorded here because it is derived from Google's results rather than stated in Google's prose. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch
=SORTN(A2:C6, 3, 2, B2:B6, FALSE) Published row 5: ties mode 2 drops rows the other modes keep {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Alice, 100, 90}, {Carol, 80, 85}, {Bob, 75, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Alice 100 90 / Carol 80 85 / Bob 75 85. Mode 2 is "Show at most the first n rows after removing duplicate rows", and this is the row that proves "duplicate" cannot mean what it says: no two rows in the data are identical, yet Devon and Eloise are both removed. They are the second row at each of the tied scores 100 and 80. A NOTE THE PAGE NEEDS AND DOES NOT HAVE: its display_ties_mode wording talks about "rows that are identical to the nth row" and "removing duplicate rows", but no two rows in its own example data are identical -- Alice and Devon share only their Test 1 score, as do Carol and Eloise. The published outputs are only consistent with "identical" and "duplicate" meaning EQUAL IN THE SORT COLUMN OR COLUMNS, not equal as whole rows. That reading is recorded here because it is derived from Google's results rather than stated in Google's prose. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch
=SORTN(A2:C6, 3, 3, B2:B6, FALSE) Published row 6: ties mode 3 returns five rows for n = 3 {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Alice, 100, 90}, {Devon, 100, 95}, {Carol, 80, 85}, {Eloise, 80, 90}, {Bob, 75, 85}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: all five students come back. Mode 3 is "Show at most the first n unique rows, but show every duplicate of these rows": the three distinct Test 1 scores are 100, 80 and 75, and every row carrying one of them is returned. It is the clearest demonstration that n counts DISTINCT SORT KEYS in this mode, not output rows. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch
=SORTN(A2:C6, 3, 3, 2, FALSE, 3, FALSE) Published row 7: two sort columns given as indices rather than ranges {#NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?, #NAME?} {{Devon, 100, 95}, {Alice, 100, 90}, {Eloise, 80, 90}}
Provenance

GOOGLE'S OWN PUBLISHED RESULT: -> Devon 100 95 / Alice 100 90 / Eloise 80 90. This row looks malformed beside the others and is not: sort_column1 is documented as "the INDEX of the column in range or a range outside of range", so the bare 2 and 3 are column indices, each followed by its own is_ascending flag. Sorting descending by Test 1 then by Test 2 orders Devon (100,95) ahead of Alice (100,90) -- reversing them relative to every other row in the table, which is what makes this the one case that proves the second sort key is honoured. Mode 3 then counts DISTINCT COMBINED SORT KEYS, not distinct Test 1 scores: the pairs (100,95), (100,90) and (80,90) are the first three, none of them duplicated, so exactly three rows come back -- where the single-column mode-3 row above returned all five. That refinement is derived from this published output; the page never says uniqueness is measured over the whole set of sort columns. ARRAY RESULT: this case spills more than one cell, so it is written as a real array formula over an explicit check_range and compared cell by cell in row-major order, the same convention SORT, UNIQUE, SEQUENCE and TEXTSPLIT already use in this corpus. Google's SORTN page, read live on 2026-08-31 at https://support.google.com/docs/answer/7354624.

Mismatch

Docs & syntax

Where SORTN behaves differently