Excel Formulas

Excel Formulas

Working, copy-ready solutions to real Excel tasks — each with a step-by-step explanation, an interactive demo you can try right here, and a free practice workbook.

These are formula recipes: how to actually do something — sum by month, look up across two criteria, count unique values. Looking for what a single function does instead? Browse the companion Excel Functions library (500+ guides). Every recipe below links to the function references it uses.


Lookup

Find a value by another value — across rows, columns, tiers, or multiple keys.

Do a case-sensitive lookup with EXACT and INDEX/MATCH.

=INDEX(C2:C8, MATCH(TRUE, EXACT(A2:A8, E2), 0))
Recipe, demo & practice file →

Return the first or last non-blank value with the LOOKUP trick or XLOOKUP.

=LOOKUP(2, 1/(A2:A100<>""), A2:A100)
Recipe, demo & practice file →

Return the most recent (last) match with XLOOKUP search_mode -1 or the LOOKUP trick.

=XLOOKUP(E2, A2:A8, C2:C8, , 0, -1)
Recipe, demo & practice file →

Return several columns from one lookup that spills the whole record.

=XLOOKUP(E2, A2:A8, B2:D8)
Recipe, demo & practice file →

Return the 2nd, 3rd, or nth match with FILTER+INDEX or INDEX/SMALL.

=INDEX(FILTER(C2:C9, A2:A9=E2), 2)
Recipe, demo & practice file →

Look up a value on two or more keys at once by joining them inside XLOOKUP or INDEX/MATCH.

=XLOOKUP(G2&"|"&G3, A2:A8&"|"&B2:B8, C2:C8)
Recipe, demo & practice file →

Look up on a fragment using wildcards with VLOOKUP or XLOOKUP.

=VLOOKUP("*"&E2&"*", A2:B8, 2, FALSE)
Recipe, demo & practice file →

Land a number in the right tier or tax bracket with XLOOKUP match_mode -1 — no nested IFs.

=XLOOKUP(D2, A2:A5, B2:B5, , -1)
Recipe, demo & practice file →

Pull the value where a row and a column meet, with nested XLOOKUP or INDEX/MATCH/MATCH.

=XLOOKUP(H2, A2:A6, XLOOKUP(H3, B1:D1, B2:D6))
Recipe, demo & practice file →

Sum

Add things up by category, period, or condition.

Build a cumulative running total with one anchored, expanding-range SUM (or SCAN).

=SUM($B$2:B2)
Recipe, demo & practice file →

Total a column on two or more conditions at once with SUMIFS (AND logic).

=SUMIFS(D2:D8, B2:B8, "West", C2:C8, "Widget")
Recipe, demo & practice file →

Sum Every Nth Row

All versions

Add every Nth row with SUMPRODUCT and MOD on the row number.

=SUMPRODUCT((MOD(ROW(B2:B13)-ROW(B2), 3)=0) * B2:B13)
Recipe, demo & practice file →

Sum only filtered/visible rows with SUBTOTAL (or AGGREGATE).

=SUBTOTAL(109, B2:B100)
Recipe, demo & practice file →

Sum by Month

Excel 365

Total values that fall in a given month with SUMIFS and EOMONTH — year-safe, no helper column.

=SUMIFS(B:B, A:A, ">="&E2, A:A, "<="&EOMONTH(E2,0))
Recipe, demo & practice file →

Sum by Quarter

All versions

Total amounts for a quarter with SUMIFS and EOMONTH date boundaries.

=SUMIFS(B:B, A:A, ">="&E2, A:A, "<="&EOMONTH(E2,2))
Recipe, demo & practice file →

Total rows whose label contains text using SUMIF with wildcards.

=SUMIF(A2:A8, "*Pro*", B2:B8)
Recipe, demo & practice file →

Add the same cell across many sheets with a 3D reference.

=SUM(Jan:Dec!B2)
Recipe, demo & practice file →

Total just the largest few values with LARGE and SUMPRODUCT — top 3, top 5, or N from a cell.

=SUMPRODUCT(LARGE(B2:B8, {1,2,3}))
Recipe, demo & practice file →

Build a region-by-month matrix report with one SUMIFS filled across and down.

=SUMIFS(amount, region, $A2, month, B$1)
Recipe, demo & practice file →

Count

Count rows, distinct values, and matches.

Count rows that meet several conditions at once with COUNTIFS.

=COUNTIFS(B2:B8, "West", D2:D8, ">=100")
Recipe, demo & practice file →

Count empty cells in a range with COUNTBLANK.

=COUNTBLANK(A2:A10)
Recipe, demo & practice file →

Count cells containing a word or fragment with COUNTIF and wildcards.

=COUNTIF(A2:A8, "*Pro*")
Recipe, demo & practice file →

Count text, numbers, non-blank or blank cells with the right COUNT function.

=COUNTIF(A2:A8, "*")
Recipe, demo & practice file →

Count dates that fall between two dates with COUNTIFS.

=COUNTIFS(A2:A10, ">="&E1, A2:A10, "<="&E2)
Recipe, demo & practice file →

Count how many dates fall on a weekday with SUMPRODUCT and WEEKDAY.

=SUMPRODUCT(--(WEEKDAY(A2:A10) = 2))
Recipe, demo & practice file →

Count how many distinct entries are in a list — COUNTA(UNIQUE()) or the classic SUMPRODUCT trick.

=COUNTA(UNIQUE(A2:A10))
Recipe, demo & practice file →

Count distinct values within each group with UNIQUE+FILTER or SUMPRODUCT.

=COUNTA(UNIQUE(FILTER(B2:B100, A2:A100=E2)))
Recipe, demo & practice file →

Group numbers into bands and count each with FREQUENCY or COUNTIFS.

=FREQUENCY(data, bins)
Recipe, demo & practice file →

Number each occurrence of a value with an expanding COUNTIF.

=COUNTIF($A$2:A2, A2)
Recipe, demo & practice file →

Average

Mean values by group, weighted, or filtered.

Average a column that contains errors with AGGREGATE option 6.

=AGGREGATE(1, 6, B2:B8)
Recipe, demo & practice file →

Average by Group

All versions

Average the values in one category with AVERAGEIF / AVERAGEIFS.

=AVERAGEIF(B2:B8, E2, C2:C8)
Recipe, demo & practice file →

Average only the best few values by nesting LARGE inside AVERAGE.

=AVERAGE(LARGE(B2:B8, {1,2,3}))
Recipe, demo & practice file →

Moving Average

All versions

Smooth a series with a rolling AVERAGE window that slides down the column.

=AVERAGE(B2:B4)
Recipe, demo & practice file →

Weighted Average

All versions

Weight some values more than others with SUMPRODUCT divided by total weight.

=SUMPRODUCT(B2:B5, C2:C5) / SUM(C2:C5)
Recipe, demo & practice file →

Min & Max

Largest and smallest values, with or without conditions.

Clamp a number between a floor and ceiling with nested MIN and MAX.

=MIN(MAX(A2, 0), 100)
Recipe, demo & practice file →

Get the 2nd, 3rd, or nth largest/smallest value with LARGE and SMALL.

=LARGE(B2:B8, 2)
Recipe, demo & practice file →

Find the biggest value in a given month with MAXIFS and date boundaries.

=MAXIFS(B:B, A:A, ">="&E2, A:A, "<="&EOMONTH(E2,0))
Recipe, demo & practice file →

Find the largest value that meets a condition with MAXIFS.

=MAXIFS(C2:C8, B2:B8, E2)
Recipe, demo & practice file →

Find the smallest value that meets a condition with MINIFS.

=MINIFS(C2:C8, B2:B8, E2)
Recipe, demo & practice file →

Logical

Decisions and tests — IF, IFS, and condition checks that label, grade, and flag.

Replace #N/A and #DIV/0! errors with a clean fallback using IFERROR / IFNA.

=IFERROR(VLOOKUP(E2, A:B, 2, 0), "")
Recipe, demo & practice file →

Turn scores into letter grades with IFS, nested IF, or a lookup table.

=IFS(B2>=90,"A", B2>=80,"B", B2>=70,"C", B2>=60,"D", TRUE,"F")
Recipe, demo & practice file →

Mark or highlight repeated values with COUNTIF — labels and conditional formatting.

=IF(COUNTIF($A$2:$A$8, A2)>1, "Duplicate", "")
Recipe, demo & practice file →

IF with AND / OR

All versions

Make an IF decision on several conditions at once by nesting AND or OR.

=IF(AND(B2>=50000, C2<=0.3), "Approve", "Review")
Recipe, demo & practice file →

Map a value to a result with SWITCH instead of nested IFs.

=SWITCH(A2, 1, "New", 2, "Open", 3, "Closed", "Unknown")
Recipe, demo & practice file →

Information

Test what's in a cell — text, errors, blanks, numbers.

Test whether a cell contains text with ISNUMBER and SEARCH.

=ISNUMBER(SEARCH(B2, A2))
Recipe, demo & practice file →

Test whether a formula errored with ISERROR or ISNA.

=IF(ISERROR(A2/B2), "Check input", "OK")
Recipe, demo & practice file →

Test whether a cell is empty with ISBLANK inside IF.

=IF(ISBLANK(A2), "Missing", "OK")
Recipe, demo & practice file →

Tell real numbers from text-numbers with ISNUMBER and ISTEXT.

=ISNUMBER(A2)
Recipe, demo & practice file →

Text

Pull apart and reshape text — split, extract, clean, and join.

Capitalize names with PROPER, or force case with UPPER and LOWER.

=PROPER(A2)
Recipe, demo & practice file →

Strip extra spaces, line breaks and non-breaking spaces with TRIM, CLEAN and SUBSTITUTE.

=TRIM(CLEAN(A2))
Recipe, demo & practice file →

Count words in a cell by counting spaces with LEN and SUBSTITUTE.

=LEN(TRIM(A2)) - LEN(SUBSTITUTE(TRIM(A2), " ", "")) + 1
Recipe, demo & practice file →

Pull first and last names out of a full-name cell with TEXTBEFORE/AFTER or LEFT/RIGHT.

=TEXTBEFORE(A2, " ") // first name =TEXTAFTER(A2, " ") // last name
Recipe, demo & practice file →

Pull the number out of mixed text with TEXTAFTER/VALUE or MID/FIND.

=VALUE(TEXTAFTER(A2, "-"))
Recipe, demo & practice file →

Pull text between two characters with TEXTBEFORE/AFTER or MID/FIND.

=TEXTBEFORE(TEXTAFTER(A2, "("), ")")
Recipe, demo & practice file →

Swap text inside a formula with SUBSTITUTE or REPLACE.

=SUBSTITUTE(A2, "-", " ")
Recipe, demo & practice file →

Combine a range of cells into one delimited string with TEXTJOIN — skips blanks.

=TEXTJOIN(", ", TRUE, A2:A6)
Recipe, demo & practice file →

Add leading zeros to numbers to a fixed width with TEXT.

=TEXT(A2, "00000")
Recipe, demo & practice file →

Break one cell into columns on a delimiter with TEXTSPLIT (or LEFT/MID/FIND).

=TEXTSPLIT(A2, "-")
Recipe, demo & practice file →

Date & Time

Work with dates: ages, durations, month boundaries.

Shift a date by whole months or years with EDATE.

=EDATE(A2, 3)
Recipe, demo & practice file →

Turn a birthdate into an age in whole years with DATEDIF and TODAY — updates itself daily.

=DATEDIF(B2, TODAY(), "Y")
Recipe, demo & practice file →

Calculate hours between two times by subtracting and multiplying by 24.

=(B2 - A2) * 24
Recipe, demo & practice file →

Turn text dates into real dates with DATEVALUE or a DATE rebuild.

=DATEVALUE(A2)
Recipe, demo & practice file →

Count days until or since a date with simple date subtraction and TODAY.

=A2 - TODAY()
Recipe, demo & practice file →

Jump to the next specific weekday from a date with WEEKDAY and MOD.

=A2 + MOD(DOW - WEEKDAY(A2) + 7, 7)
Recipe, demo & practice file →

Get the first or last day of any month with EOMONTH — leap-year safe.

=EOMONTH(A2, 0) // last day of A2's month =EOMONTH(A2, -1) + 1 // first day of A2's month
Recipe, demo & practice file →

Get the day-of-week name from a date with TEXT (dddd / ddd).

=TEXT(A2, "dddd")
Recipe, demo & practice file →

Turn a date into its calendar quarter with MONTH and ROUNDUP.

=ROUNDUP(MONTH(A2)/3, 0)
Recipe, demo & practice file →

Get the ISO or US week number of a date with ISOWEEKNUM / WEEKNUM.

=ISOWEEKNUM(A2)
Recipe, demo & practice file →

Find the nth weekday of a month (3rd Thursday) with DATE and WEEKDAY.

=DATE(Y,M,1) + MOD(DOW - WEEKDAY(DATE(Y,M,1)), 7) + (N-1)*7
Recipe, demo & practice file →

Find how many days are in a month with EOMONTH and DAY (leap-safe).

=DAY(EOMONTH(A2, 0))
Recipe, demo & practice file →

Split daily hours into regular and overtime with MIN and MAX.

=MIN(A2, 8) // regular hours =MAX(A2 - 8, 0) // overtime hours
Recipe, demo & practice file →

Count business days between dates, skipping weekends and holidays, with NETWORKDAYS.

=NETWORKDAYS(B2, C2)
Recipe, demo & practice file →

Dynamic Arrays

Modern spilling formulas — FILTER, UNIQUE, SORT — that update themselves.

Aggregate an array to one value with REDUCE and LAMBDA.

=REDUCE(0, B2:B100, LAMBDA(acc, val, acc + (val>100)*val))
Recipe, demo & practice file →

Build a reusable custom function with LAMBDA + Name Manager.

=LAMBDA(price, price * 1.08)
Recipe, demo & practice file →

Build a calculated grid from row/column positions with MAKEARRAY.

=MAKEARRAY(3, 3, LAMBDA(r, c, r * c))
Recipe, demo & practice file →

Append ranges into one with VSTACK and HSTACK.

=VSTACK(Jan, Feb, Mar)
Recipe, demo & practice file →

Pull every record matching a condition into a report area with FILTER (or INDEX/SMALL).

=FILTER(A2:C9, B2:B9=F1, "None")
Recipe, demo & practice file →

Extract every row that meets a condition into a live, self-updating range with FILTER.

=FILTER(A2:C10, B2:B10=F1, "No matches")
Recipe, demo & practice file →

Flatten a grid into one column with TOCOL (or TOROW).

=TOCOL(B2:D10, 1)
Recipe, demo & practice file →

Spill a list of numbers, dates, or a grid with SEQUENCE.

=SEQUENCE(10)
Recipe, demo & practice file →

Reference a whole spill range with the # operator.

=SUM(A2#)
Recipe, demo & practice file →

Fold a list into a grid of any width with WRAPROWS / WRAPCOLS.

=WRAPROWS(A2:A13, 3)
Recipe, demo & practice file →

Make running totals, max, or product with SCAN and LAMBDA.

=SCAN(0, B2:B6, LAMBDA(acc, val, acc + val))
Recipe, demo & practice file →

Sort a table by several keys with SORTBY (live formula).

=SORTBY(A2:C100, A2:A100, 1, C2:C100, -1)
Recipe, demo & practice file →

Summarize each row or column with BYROW / BYCOL.

=BYROW(B2:D10, LAMBDA(row, SUM(row)))
Recipe, demo & practice file →

Transform every value of an array with MAP and LAMBDA.

=MAP(B2:B100, LAMBDA(p, p * 1.08))
Recipe, demo & practice file →

Turn a column with repeats into a clean, alphabetized list with SORT(UNIQUE()).

=SORT(UNIQUE(A2:A10))
Recipe, demo & practice file →

Rank

Order and position values — leaderboards, rankings, top performers.

Rank a list highest-to-lowest with RANK.EQ, including a no-gaps tiebreaker.

=RANK.EQ(B2, $B$2:$B$8)
Recipe, demo & practice file →

Percentage

Percent change, percent of total, and percentage math.

Calculate percent change and percent of total — the right base and formatting.

=(B2 - A2) / A2
Recipe, demo & practice file →

Round

Round to decimals, multiples, or always up/down.

Always round up or down with ROUNDUP, ROUNDDOWN, CEILING and FLOOR.

=ROUNDUP(A2, 0) // up to whole number =CEILING(A2, 10) // up to next multiple of 10
Recipe, demo & practice file →

Round to N significant figures with ROUND and LOG10.

=ROUND(A2, 3 - 1 - INT(LOG10(ABS(A2))))
Recipe, demo & practice file →

Round to decimal places with ROUND or to any multiple with MROUND.

=ROUND(A2, 2) // 2 decimal places =MROUND(A2, 25) // nearest multiple of 25
Recipe, demo & practice file →

Financial

Loans, savings, interest, and investment math.

Compute the compound annual growth rate from a start and end value.

=(B2 / B1)^(1 / B3) - 1
Recipe, demo & practice file →

Calculate a fixed loan payment from rate, term and amount with PMT.

=PMT(B1/12, B2*12, B3)
Recipe, demo & practice file →

Compound Interest

All versions

Grow a lump sum with the compound interest formula (1+rate)^periods.

=B1 * (1 + B2)^B3
Recipe, demo & practice file →

Project what regular savings grow to with FV and compound interest.

=FV(B1/12, B2*12, -B3)
Recipe, demo & practice file →

Value future cash flows in today's money with NPV (initial added outside).

=NPV(B1, B3:B7) + B2
Recipe, demo & practice file →

Conditional Formatting

Formula-driven rules that highlight rows and cells automatically.

Add alternating row shading with ISEVEN(ROW()) — zebra stripes.

=ISEVEN(ROW())
Recipe, demo & practice file →

Turn numbers into a color-gradient heat map with Color Scales.

Home → Conditional Formatting → Color Scales
Recipe, demo & practice file →

Highlight rows missing any data with COUNTBLANK in a CF rule.

=COUNTBLANK($A2:$D2) > 0
Recipe, demo & practice file →

Highlight whole rows with a formula rule — the $C2 mixed-reference trick.

=$C2="Overdue"
Recipe, demo & practice file →

Shade the top N values with a LARGE-based conditional-formatting rule.

=B2>=LARGE($B$2:$B$10, 3)
Recipe, demo & practice file →

Data Validation

Drop-down lists and controlled data entry.

Build a drop-down list with Data Validation so entry is pick-from-a-menu.

=$F$2:$F$6
Recipe, demo & practice file →

Make a cascading drop-down where the second list depends on the first (INDIRECT).

=INDIRECT(A2)
Recipe, demo & practice file →

Block duplicate entries with a COUNTIF data-validation rule.

=COUNTIF($A$2:$A$1000, A2) <= 1
Recipe, demo & practice file →

Limit a cell to whole numbers or a value range with Data Validation.

Whole number → between → 1 and 100
Recipe, demo & practice file →

Statistics

Median, percentiles, spread, correlation, forecasting, and outliers.

Measure how two columns move together with CORREL (-1 to +1).

=CORREL(B2:B100, C2:C100)
Recipe, demo & practice file →

Flag outliers with the IQR rule (QUARTILE) or a z-score test.

=OR(B2 < Q1 - 1.5*IQR, B2 > Q3 + 1.5*IQR)
Recipe, demo & practice file →

Project a future value along a trend line with FORECAST or TREND.

=FORECAST(newX, known_Ys, known_Xs)
Recipe, demo & practice file →

Find the median within a group with MEDIAN+FILTER or MEDIAN(IF()).

=MEDIAN(FILTER(B2:B100, A2:A100=E2))
Recipe, demo & practice file →

Compute percentiles and quartiles with PERCENTILE and QUARTILE.

=PERCENTILE(B2:B100, 0.9)
Recipe, demo & practice file →

Measure spread with STDEV.S (sample) or STDEV.P (population).

=STDEV.S(B2:B100)
Recipe, demo & practice file →

More recipes publishing regularly. We’re adding new formula recipes across text, logic, conditional formatting, ranking and percentages. Want one covered next? Tell us what you’re stuck on.

Learn the formulas that matter, in one day

Our hands-on Excel Formulas & Functions class turns these recipes into skills — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class