25 Excel formulas every data analyst should know
The lookup, summary, logic, text, date and dynamic-array formulas that cover almost all everyday analysis, each with an example, a common mistake, and which Excel versions have it.
Excel has more than 500 functions. In practice, a few dozen cover nearly all real analysis work. These are the 25 I’d teach first. Each comes with an example you can adapt, the mistake people usually make with it, and a note when it needs a newer version of Excel.
If you know what you want but not the formula, describe it to the Excel formula helper and it writes the formula for your Excel version.
Version key: (365) needs Excel 365 or Excel 2021 and later; (2019) needs Excel 2019 or later; unmarked formulas work in every current version. Most also work in Google Sheets; the exceptions are TEXTBEFORE, TEXTAFTER and SORTBY (use SPLIT, REGEXEXTRACT and SORT there).
Lookups
1. XLOOKUP (365)
Finds a value and returns the matching value from another column.
=XLOOKUP(A2, Products!A:A, Products!C:C, "Not found")
Mistake: forgetting the fourth argument and getting #N/A for missing codes. It’s built in, so use it.
2. INDEX + MATCH
The lookup that works in every version, and can look left.
=INDEX(Products!C:C, MATCH(A2, Products!A:A, 0))
Mistake: leaving out the 0 in MATCH, which switches to an approximate match on unsorted data.
3. VLOOKUP
You’ll meet it in every inherited workbook, so you need to read it, even if you write XLOOKUP.
=VLOOKUP(A2, Products!A:C, 3, FALSE)
Mistake: omitting FALSE. The default is an approximate match, which returns plausible wrong answers. See VLOOKUP vs XLOOKUP vs INDEX-MATCH.
Summaries with conditions
4. SUMIFS
Totals rows that meet one or more conditions.
=SUMIFS(D:D, B:B, "North", C:C, ">="&DATE(2026,1,1))
Mistake: putting the sum range last, as in the older SUMIF. In SUMIFS the sum range comes first.
5. COUNTIFS
Counts rows that meet conditions.
=COUNTIFS(B:B, "North", E:E, "Returned")
6. AVERAGEIFS
The average of the matching rows.
=AVERAGEIFS(D:D, B:B, "North")
Mistake: blank cells in the average range are skipped, but zeros count. That’s often the reason an “average order value” looks too low.
7. MAXIFS and MINIFS (2019)
The largest or smallest value that meets a condition, for example the biggest order per region.
=MAXIFS(D:D, B:B, "North")
Logic
8. IF
=IF(D2 >= 1000, "Large", "Small")
9. IFS (2019)
Several conditions without nesting IFs, checked in order.
=IFS(D2 >= 10000, "A", D2 >= 1000, "B", TRUE, "C")
Mistake: no final TRUE catch-all, so rows matching nothing return #N/A.
10. IFERROR
Replaces any error with a value you choose.
=IFERROR(B2 / C2, 0)
Mistake: wrapping everything in IFERROR. It hides real problems too, like a misspelled range. Use it on the specific error you expect.
11. AND / OR
Combine conditions inside IF.
=IF(AND(D2 >= 1000, E2 = "Yes"), "Priority", "Normal")
Text cleanup
12. TRIM
Removes extra spaces, the invisible cause of failed lookups and “duplicates” that won’t go away.
=TRIM(A2)
Data pasted from websites sometimes contains non-breaking spaces, which TRIM ignores. Use =TRIM(SUBSTITUTE(A2, CHAR(160), " ")).
13. TEXTBEFORE / TEXTAFTER (365, Excel 2024)
Split text at a character. These are newer than the other 365 functions: they’re in Excel 365 and Excel 2024, but not Excel 2021.
=TEXTAFTER(A2, "@") → domain of an email
=TEXTBEFORE(A2, " ") → first word
14. LEFT, RIGHT, MID with FIND
The way to do the same in any version.
=MID(A2, FIND("@", A2) + 1, LEN(A2))
15. SUBSTITUTE
Replaces text inside a cell, for example removing currency symbols before a calculation.
=VALUE(SUBSTITUTE(A2, "₹", ""))
16. TEXTJOIN (2019)
Joins a range with a separator and skips blanks.
=TEXTJOIN(", ", TRUE, B2:F2)
17. TEXT
Formats a number or date as text, for labels and file names.
=TEXT(A2, "dd mmm yyyy") → 04 Jan 2026
=TEXT(B2, "#,##0.00") → 1,450.00
Mistake: using TEXT in a column you later calculate with. The result is text, not a number.
Dates
18. TODAY
Today’s date. It recalculates every time the workbook opens.
=TODAY() - A2 → days since the date in A2
19. EOMONTH
The last day of a month, handy for grouping by month and building month-end reports.
=EOMONTH(A2, 0) → end of A2's month
=EOMONTH(A2, -1) + 1 → first day of A2's month
20. DATEDIF
Complete years, months or days between two dates. It’s undocumented in recent Excel help, but works in every version.
=DATEDIF(A2, TODAY(), "Y") → age or tenure in whole years
21. NETWORKDAYS
Working days between two dates, optionally excluding a list of holidays.
=NETWORKDAYS(A2, B2, Holidays!A2:A20)
Dynamic arrays (365)
These return many values at once. The result “spills” into the cells below.
22. UNIQUE
A list of distinct values, kept up to date automatically.
=UNIQUE(B2:B500)
23. FILTER
The rows that meet a condition, as a live extract.
=FILTER(A2:E500, B2:B500 = "North", "No rows")
24. SORT / SORTBY
Sorted copies of a range, without touching the original.
=SORTBY(A2:E500, D2:D500, -1) → by column D, largest first
Combined: =SORT(UNIQUE(B2:B500)) gives a sorted list of distinct values in one cell.
The all-rounder
25. SUMPRODUCT
Multiplies and adds ranges, which makes it the pre-365 way to do almost any conditional calculation.
=SUMPRODUCT((B2:B500 = "North") * (C2:C500 >= DATE(2026,1,1)) * D2:D500)
Each condition becomes 1 or 0, so only matching rows contribute to the total. It also counts unique values in older Excel:
=SUMPRODUCT((A2:A500 <> "") / COUNTIF(A2:A500, A2:A500 & ""))
From experience: the formulas that save the most time aren’t the clever ones. They’re TRIM, a consistent lookup (XLOOKUP or INDEX-MATCH, used everywhere the same way), and SUMIFS instead of filtering by hand. Most “the numbers don’t match” problems I’ve debugged came down to stray spaces, an approximate VLOOKUP, or a manual filter that someone forgot to clear.
Two habits that make any formula better
- Use exact ranges in big sheets.
D2:D5000recalculates much faster thanD:D, especially inside SUMPRODUCT and array formulas. Better still, format the data as a table (Ctrl + T) and use names likeSales[Amount], which grow automatically. - Use LET (365) for long formulas. It names intermediate results, so a formula reads like steps instead of a wall of brackets:
=LET(total, SUM(D2:D500), returns, SUMIFS(D2:D500, E2:E500, "Returned"), returns / total)
Stuck on a formula someone else wrote? Paste it into the formula helper’s Explain mode and it’s broken down part by part.