How to find the most common text value (mode for text)
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)The most-repeated label in a column — the best-selling product, the top response, the modal category. MODE only works on numbers, so text needs a different trick.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =INDEX(A2:A6,MATCH(MAX(COUNTIF(A2:A6,A2:A6)),COUNTIF(A2:A6,A2:A6),0)) | MODE errors on text. COUNTIF-against-itself scores each cell by its frequency; MATCH(MAX(...)) finds the winner. In older Excel enter with Ctrl+Shift+Enter. |
| Google Sheets | =INDEX(A2:A6,MATCH(MAX(COUNTIF(A2:A6,A2:A6)),COUNTIF(A2:A6,A2:A6),0)) | Identical. Or =INDEX(SORTN(A2:A6,1,0,A2:A6,FALSE),1) style with COUNTIF sorting. |
| LibreOffice Calc | =INDEX(A2:A6,MATCH(MAX(COUNTIF(A2:A6,A2:A6)),COUNTIF(A2:A6,A2:A6),0)) | Identical; array-enter with Ctrl+Shift+Enter in older builds. |
How it works
COUNTIF(A2:A6,A2:A6) is the key move: it compares the range to itself and returns an array of each cell's occurrence count — here {3;1;3;3;1}, because 'apple' shows up three times. MAX of that array is the highest frequency (3), and MATCH finds the first position that hits it, which INDEX turns back into the value 'apple'. This works on text where MODE — a numbers-only function — would return #N/A. If two values tie for most-common it returns the first one; to surface ties, wrap the count logic in a filter. On modern Google Sheets or Excel 365, SORTN / a COUNTIF-keyed SORT does the same thing without array entry.
Verified, not just documented
We ran =INDEX(A2:A6,MATCH(MAX(COUNTIF(A2:A6,A2:A6)),COUNTIF(A2:A6,A2:A6),0)) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned apple — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned apple for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
INDEX · MATCH · MAX · COUNTIF — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to find the label that goes with the highest value
- How to do a case-sensitive lookup
- How to look up the closest match (tax brackets, tiers, grades)
- How to find the position of the maximum value
- How to use INDEX/MATCH