Formuladrill

Formuladrill / Cheat sheet

Excel formulas cheat sheet

A hundred and twelve formulas in nine groups with the syntax you actually type, a note on the mistake people make, and a drill for most of them. Print the page (it is laid out for A4 and Letter) or get the PDF by email.

No newsletter spam: the PDF, one follow-up with the free exercises, and nothing else unless you ask.

The ones worth learning first

WhatHow
Add a column=SUM(B2:B20)
Add only the rows that match=SUMIFS(C:C, A:A, "North", B:B, ">100")
Look something up (new Excel)=XLOOKUP(E2, A:A, C:C, "Not found")
Look something up (any Excel)=INDEX(C:C, MATCH(E2, A:A, 0))
One result or another=IF(B2>=50, "Pass", "Fail")
Hide an error=IFERROR(A2/B2, 0)
Lock a reference before filling$B$1 (press F4 in the formula)
Percent change=(C2-B2)/B2
Loan payment=PMT(rate/12, years*12, -principal)
Count the rows that match=COUNTIFS(A:A, "North", B:B, ">100")

Totals and counts

Sum a range=SUM(B2:B20) drill
Average=AVERAGE(B2:B20) drill
Smallest and largest=MIN(B2:B20) =MAX(B2:B20) drill
Count numbersCounts cells that hold numbers only.=COUNT(B2:B20) drill
Count non-empty cells=COUNTA(A2:A20) drill
Count blanks=COUNTBLANK(A2:A20)
Median=MEDIAN(B2:B20) drill
Second largestSMALL(range, k) for the k-th smallest.=LARGE(B2:B20, 2) drill
Weighted total (price x quantity)=SUMPRODUCT(B2:B20, C2:C20) drill
Running total=SUM($B$2:B2) then fill down drill
Round to 2 decimalsROUNDUP and ROUNDDOWN force the direction.=ROUND(B2, 2) drill
Round to nearest 1,000=ROUND(B2, -3)
Margin=(C2-B2)/C2 drill
Percent change=(C2-B2)/B2 drill
Share of totalLock the total with $ or it slides when you fill down.=B2/SUM($B$2:$B$20) drill

Conditions

If, then, else=IF(B2>=50, "Pass", "Fail") drill
Several conditions in order=IFS(B2>=90, "A", B2>=80, "B", TRUE, "C") drill
Nested IF (older Excel)=IF(B2>=90, "A", IF(B2>=80, "B", "C")) drill
Both must be true=IF(AND(B2>100, C2="Yes"), bonus, 0) drill
Either may be true=IF(OR(B2>100, C2="VIP"), "Call", "") drill
Not=IF(NOT(ISBLANK(A2)), "Filled", "Empty")
Count if one conditionWildcards: "North*" matches North East.=COUNTIF(A:A, "North") drill
Count if several conditions=COUNTIFS(A:A, "North", B:B, ">100") drill
Count above a cell's valueJoin the operator and the cell with &.=COUNTIF(B:B, ">"&E1) drill
Sum if one condition=SUMIF(A:A, "North", C:C) drill
Sum if several conditionsSum range comes first in SUMIFS, last in SUMIF.=SUMIFS(C:C, A:A, "North", B:B, ">100") drill
Average if=AVERAGEIF(A:A, "North", C:C) drill
Largest that matchesMINIFS for the smallest.=MAXIFS(C:C, A:A, "North") drill
Between two dates=SUMIFS(C:C, A:A, ">="&E1, A:A, "<="&E2)

Lookups

Exact lookup, any version=INDEX(C:C, MATCH(E2, A:A, 0)) drill
Exact lookup, Excel 2021 and 365=XLOOKUP(E2, A:A, C:C, "Not found") drill
VLOOKUP exactFALSE means exact. Leaving it out gives approximate.=VLOOKUP(E2, A:C, 3, FALSE) drill
VLOOKUP approximate (tax bands, grades)Table must be sorted ascending on the first column.=VLOOKUP(E2, A:B, 2, TRUE) drill
Lookup to the leftVLOOKUP cannot look left; INDEX/MATCH and XLOOKUP can.=XLOOKUP(E2, C:C, A:A) drill
Position of a value=MATCH(E2, A:A, 0) drill
Two-way lookup (row and column)=INDEX(B2:F20, MATCH(H1, A2:A20, 0), MATCH(H2, B1:F1, 0)) drill
Last match instead of first=XLOOKUP(E2, A:A, C:C, , 0, -1)
Lookup with two keys=XLOOKUP(E2&F2, A:A&B:B, C:C)
Return several columnsSpills across three cells in 365.=XLOOKUP(E2, A:A, B:D)
Trim the key before looking up=XLOOKUP(TRIM(E2), A:A, C:C) drill
Horizontal lookup=HLOOKUP(E1, A1:F5, 3, FALSE)
Pick by position=CHOOSE(B2, "Low", "Mid", "High")

Text

Join text=A2&" "&B2 drill
Join with a separator, skip blanks=TEXTJOIN(", ", TRUE, A2:A10) drill
First or last characters=LEFT(A2, 3) =RIGHT(A2, 4)
Middle characters=MID(A2, 3, 5)
Everything after a characterOlder Excel: =MID(A2, FIND("@",A2)+1, 99)=TEXTAFTER(A2, "@") drill
Everything before a character=TEXTBEFORE(A2, " ")
Find a positionSEARCH ignores case and allows wildcards.=FIND("@", A2)
Replace text=SUBSTITUTE(A2, "Ltd", "Limited") drill
Remove extra spaces=TRIM(A2) drill
Capitalize names=PROPER(A2) drill
Upper and lower case=UPPER(A2) =LOWER(A2)
Length=LEN(A2)
Text that looks like a number=VALUE(A2) or =A2*1 drill
Number as formatted text=TEXT(B2, "#,##0.00")
Date as text=TEXT(A2, "mmm yyyy")
Repeat a character=REPT("-", 20)
Split by delimiter (365)=TEXTSPLIT(A2, ",")

Dates

TodayRecalculates every day. Ctrl+; types a fixed date.=TODAY()
Now, with time=NOW()
Days between=B2-A2 drill
Due date=A2+30 drill
Add months=EDATE(A2, 3) drill
End of monthEOMONTH(A2, -1) is the end of last month.=EOMONTH(A2, 0) drill
Year, month, day=YEAR(A2) =MONTH(A2) =DAY(A2) drill
Build a date=DATE(2026, 12, 31)
Weekday name=TEXT(A2, "dddd")
Working days between=NETWORKDAYS(A2, B2)
Add working days=WORKDAY(A2, 10)
Age in years=DATEDIF(A2, TODAY(), "y")
Text date to a real date=DATEVALUE(A2) drill

Finance

Loan paymentNegative principal gives a positive payment.=PMT(rate/12, years*12, -principal) drill
Present value=PV(rate, n, -payment) drill
Future value=FV(rate, n, -payment, -start) drill
Net present valueNPV starts one period out; add the year-0 cash flow outside.=NPV(rate, C2:C6) + C1 drill
Internal rate of return=IRR(C1:C6) drill
Compound annual growthOr =RRI(years, start, end).=(end/start)^(1/years)-1 drill
Total interest paid=-CUMIPMT(rate/12, n, principal, 1, n, 0) drill
Interest in one period=IPMT(rate/12, period, n, -principal)
Principal in one period=PPMT(rate/12, period, n, -principal)
Number of payments=NPER(rate/12, -payment, principal)
Rate per period=RATE(n, -payment, principal)*12
Break-even units=fixed/(price-variable) drill
Straight-line depreciation=SLN(cost, salvage, life) drill

Errors and checks

Replace any error=IFERROR(A2/B2, 0) drill
Replace only #N/A=IFNA(VLOOKUP(...), "Missing")
Is it a number=ISNUMBER(A2)
Is it blank=ISBLANK(A2)
Is it an error=ISERROR(A2)
Flag duplicates=COUNTIF($A$2:A2, A2)>1 drill
Check two totals agree=ABS(B20-C20)<0.01
Find a hard-coded number in a formula column=ISFORMULA(C2) drill
Show the formula text=FORMULATEXT(C2)

Arrays and dynamic functions (365)

Unique values=UNIQUE(A2:A100)
SortColumn 3, descending.=SORT(A2:C100, 3, -1)
Filter rows=FILTER(A2:C100, B2:B100>100, "None")
Sequence of numbers=SEQUENCE(12)
Sum of a filtered set=SUM(FILTER(C2:C100, A2:A100="North"))
Apply a formula to each row=BYROW(B2:D100, LAMBDA(r, SUM(r)))
Reuse a calculation=LET(x, B2*C2, IF(x>100, x, 0))
Transpose=TRANSPOSE(A1:E1)
Count unique=ROWS(UNIQUE(A2:A100))

References

Lock row and column$B$1 drill
Lock the row onlyFill across: column moves, row stays.B$1
Lock the column onlyFill down: row moves, column stays.$B1
Cycle the locksF4 while the cursor is on the reference
Another sheet=Data!B2
Sheet name with a space='Raw data'!B2
Whole column=SUM(B:B)
Address from text=INDIRECT("B"&E1)
Shifted rangeVolatile; prefer INDEX when you can.=OFFSET(A1, 2, 0, 5, 1)

formuladrill.com: practice every one of these with instant checking. 112 entries.

Questions

Which Excel formulas should I learn first?

SUM, SUMIFS, COUNTIFS, IF, IFERROR, XLOOKUP or INDEX/MATCH, and absolute references with F4. Those cover most of a working day; the rest are variations.

XLOOKUP or VLOOKUP?

XLOOKUP if everyone who opens the file has Excel 2021 or 365: it looks left, defaults to exact match and has a built-in not-found value. INDEX/MATCH works everywhere. VLOOKUP is fine for a quick exact lookup to the right, as long as you type FALSE.

Why does my formula change when I fill it down?

Relative references move with the formula. Lock the part that must not move with $ (press F4 in the formula): $B$1 locks both, B$1 locks the row, $B1 locks the column.

Why does SUMIFS return 0?

Usually the criteria do not match the data exactly: trailing spaces, numbers stored as text, or a date typed as text. TRIM and VALUE on the data, or on the criteria, fix most cases.

Do these work in Google Sheets?

Nearly all of them. TEXTAFTER, TEXTBEFORE, TEXTSPLIT, LET and BYROW are newer in Sheets; FILTER, UNIQUE and SORT have been there for years.

A cheat sheet does not make them stick

Doing them with instant checking does. The free exercises need no account.

Start practicing