Google Sheets AGGREGATE Excel Equivalent: Fix Formula
Excel AGGREGATE with INDEX fails in Google Sheets after import. Get the working FILTER + INDEX replacement for nth matches on criteria in columns E and F. Includes QUERY and SMALL alternatives for google sheets formulas.
Excel AGGREGATE formula with INDEX works perfectly but fails in Google Sheets after import. How to fix or convert it for Google Sheets compatibility?
Excel formula (working):
=IFERROR(
INDEX(
'Master Entries'!A$3:A$250,
AGGREGATE(
15,
6,
(ROW('Master Entries'!A$3:A$250)-ROW('Master Entries'!A$3)+1)
/('Master Entries'!$E$3:$E$250=$C$2)
/('Master Entries'!$F$3:$F$250="x"),
ROW(A1)
)
),
""
)
Google Sheets auto-converted version (not working, returns nothing):
=ARRAY_CONSTRAIN(
ARRAYFORMULA(
IFERROR(
INDEX(
'Master Entries'!A$3:A$250,
AGGREGATE(
15,
6,
(ROW('Master Entries'!A$3:A$250)-ROW('Master Entries'!A$3)+1)
/('Master Entries'!$E$3:$E$250=$C$2)
/('Master Entries'!$F$3:$F$250="x"),
ROW(A1)
)
),
""
)
),
1,
1
)
What is the correct Google Sheets equivalent to retrieve the nth matching value from column A where columns E and F match specific criteria?
Google Sheets doesn’t support Excel’s AGGREGATE function, which is why your imported formula fails and returns nothing—it’s a common snag when moving google sheets excel workflows. The fix? Swap it for FILTER combined with INDEX to grab the nth match from column A where E equals C2 and F is “x”, like this: =IFERROR(INDEX(FILTER('Master Entries'!A$3:A$250, 'Master Entries'!$E$3:$E$250=$C$2, 'Master Entries'!$F$3:$F$250="x"), ROW(A1)), ""). Drag it down, and you’ll get sequential matches, ignoring errors just like aggregate excel did.
Contents
- Why AGGREGATE Fails in Google Sheets
- Best Replacement: FILTER + INDEX
- Array Formula Alternative with SMALL
- QUERY for Flexible Nth Matches
- Full Setup and Copy-Paste Ready Formulas
- Troubleshooting Common Errors
- Sources
- Conclusion
Why AGGREGATE Fails in Google Sheets
Ever imported an Excel sheet into Google Sheets and watched formulas crumble? That’s your AGGREGATE at work—or rather, not working. Excel’s AGGREGATE(15,6,…) cleverly finds the nth smallest row number matching criteria while ignoring errors and hidden rows. But Google Sheets skips this function entirely. No warnings, just blank results.
Your auto-converted version wraps it in ARRAYFORMULA and ARRAY_CONSTRAIN, but that doesn’t revive the dead—AGGREGATE still bombs out. Why? Sheets prioritizes different array tools like FILTER and QUERY. According to Google’s own community support, direct imports often need manual rewrites for these nth-match scenarios.
The good news? Replacements are simpler and often faster. No more division tricks to force errors.
Best Replacement: FILTER + INDEX
FILTER is your new best friend for google sheets formulas mimicking aggregate excel. It pulls all rows from A where E=$C$2 and F=“x”, then INDEX snags the nth one using ROW(A1) as the position.
Here’s the exact drop-in:
=IFERROR(INDEX(FILTER('Master Entries'!A$3:A$250, 'Master Entries'!$E$3:$E$250=$C$2, 'Master Entries'!$F$3:$F$250="x"), ROW(A1)), "")
Copy to A1, drag down to A10 (or whatever). ROW(A1) becomes 1,2,3… automatically. No array entry needed—Sheets handles it natively.
This mirrors your original: FILTER replaces the AGGREGATE’s error-ignoring row math. As one Stack Overflow solution nails it, this grabs matching rows upfront, skipping the division hacks.
Test it. If no matches? IFERROR spits “”. Perfect for dynamic lists.
What if your range is huge? FILTER scales fine up to Sheets’ limits (millions of cells). Lighter than array formulas too.
Array Formula Alternative with SMALL
Prefer something closer to Excel’s array vibe? Use SMALL with IF to build row numbers only for matches.
=IFERROR(INDEX('Master Entries'!A$3:A$250, SMALL(IF(('Master Entries'!$E$3:$E$250=$C$2)*('Master Entries'!$F$3:$F$250="x"), ROW('Master Entries'!A$3:A$250)-ROW('Master Entries'!A$3)+1), ROW(A1))), "")
Ctrl+Shift+Enter? Nah, just paste—Sheets auto-arrays it. The IF multiplies booleans (true=1, false=0), so only matching rows get their relative position. SMALL picks the nth smallest.
This replicates AGGREGATE’s ignore-errors logic via IFERROR. A detailed Stack Overflow thread breaks it down for multi-criteria pulls.
Pro: Handles non-contiguous matches well. Con: Slower on massive datasets. But for A3:A250? Snappy.
Drag down like before. Boom—nth values flow.
QUERY for Flexible Nth Matches
Want SQL-like power? QUERY shines for google sheets query tricks.
=IFERROR(QUERY('Master Entries'!A$3:F$250, "select A where E = '"&$C$2&"' and F = 'x' offset "&(ROW(A1)-1)&" limit 1"), "")
OFFSET skips prior matches; LIMIT grabs one. Super flexible—add sorts or more columns easy.
From this Web Apps Exchange post, wrap in ARRAY_CONSTRAIN for single cells if needed. But for dragging? Straight QUERY wins.
Handles text/numbers seamlessly. C2 a date? Tweak quotes. F not exactly “x”? Use contains(‘x’).
Tradeoff: String concatenation feels fiddly at first. Once hooked, though? QUERY owns complex filters.
Full Setup and Copy-Paste Ready Formulas
Let’s walk through it. Assume ‘Master Entries’ sheet exists, C2 holds your E-value, F=“x” fixed.
- In target sheet, cell A1: Paste the FILTER version above.
- Select A1, copy down (Ctrl+D or drag fill handle).
- Matches appear: 1st in A1, 2nd in A2, etc.
- No matches past the last? Blanks.
Full table example—say C2=“Apple”:
| Position | Formula Result |
|---|---|
| A1 | Apple Variety 1 |
| A2 | Apple Variety 2 |
| A3 | (blank) |
For dynamic ranges? Swap A$3:A$250 with A3:A. FILTER auto-adjusts.
Multi-sheet? Works across tabs. C2 changes? Recalcs instantly.
Another Stack Overflow gem tweaks for variable criteria like K3/K5.
Edge case: Duplicates? All appear in sequence. Unique only? Add Col1<>Col1 prev, but that’s advanced.
Troubleshooting Common Errors
Formula returns #N/A or #REF? Check these:
- #N/A on INDEX: Fewer matches than ROW(A1). Solution: IFERROR catches it—ensure it’s wrapped.
- FILTER parses empty: No matches at all. Test criteria separately:
=FILTER(A3:A250, E3:E250="your C2 value", F3:F250="x"). - Arrayformula wrapper fails: Ditch it—native FILTER doesn’t need it.
- Regional settings: Commas vs semicolons? US uses , others ;. Flip if #ERROR.
- Large ranges slow: Limit to A3:A1000 or use IMPORTRANGE for external.
QUERY offset negative? ROW(A1)-1 fixes to 0.
Still stuck? Share a sample sheet link—communities like Web Apps Stack Exchange debug fast.
Performance tip: For 1000+ rows, FILTER beats SMALL arrays every time.
Sources
- Google Sheets equivalent for Excel’s AGGREGAT formula — Exact FILTER+INDEX replacement for nth matches: https://stackoverflow.com/questions/55951165/google-sheets-equivalent-for-excels-aggregat-formula
- Using AGGREGATE formula on Google Sheets — ARRAY_CONSTRAIN and QUERY offset alternatives: https://webapps.stackexchange.com/questions/121867/using-aggregate-formula-on-google-sheets-finding-the-correct-result-based-on-3
- Aggregate equivalent in Google Sheet — SMALL+IF array mimicking AGGREGATE logic: https://stackoverflow.com/questions/51288881/aggregate-equivalent-in-google-sheet
- Google Sheets - returning Nth result with multiple matching criteria — Multi-criteria INDEX/SMALL examples: https://stackoverflow.com/questions/79187568/google-sheets-returning-nth-result-with-multiple-matching-criteria
- Excel Aggregate in Google Sheets — Official no-AGGREGATE confirmation and FILTER rec: https://support.google.com/docs/thread/229600270/excel-aggregate-in-google-sheets?hl=en
Conclusion
Ditch AGGREGATE heartache—Google Sheets thrives with FILTER+INDEX for clean nth matches on your E/F criteria. Start with the copy-paste ready formula, tweak as needed, and your google sheets excel imports will hum. Faster, native, no errors. Questions? Test in a blank sheet first—you’ll wonder why Excel complicated it.