Formula reference
Every function a sheet can compute, each with an example over the small sheet below and the answer it gives. The examples are worked by the same engine your sheets use.
| AClaim | BFee | CStatus | DHours | |
|---|---|---|---|---|
| 1 | Late delivery | 1,200 | open | 4 |
| 2 | Damaged goods | 450 | closed | 2 |
| 3 | Wrong item | 800 | open | 3 |
| 4 | Missing parts | 450 | pending | 2 |
| 5 | Refund delay | 2,500 | open | 9 |
| 6 | closed | 1 |
Writing a formula
- Start the cell with =. A1 is column A of the first row of data; the column names are headings, not a row.
- A range runs corner to corner: B1:B6 is six cells of one column, A1:B6 two columns.
- Name a range in the inspector (Fees = B2:B40) and write the name instead.
- Text goes in double quotes: =IF(B1>1000, "large", "small").
- A formula reads the tab it is on.
Math
Adds the numbers in its arguments. Text and blank cells are skipped.
=SUM(B1:B6)gives 5,400The mean of the numbers. Text and blanks are skipped; with no numbers at all the answer is #DIV/0!.
=AVERAGE(B1:B6)gives 1,080How many of the cells hold a number.
=COUNT(B1:B6)gives 5How many of the cells are not blank, whatever they hold. A cell of only spaces counts as blank.
=COUNTA(A1:A6)gives 5The smallest number.
=MIN(B1:B6)gives 450The largest number.
=MAX(B1:B6)gives 2,500Rounds to the given number of decimal places; with no digits, to a whole number.
=ROUND(B1/7, 1)gives 171.4The number without its sign.
=ABS(B2-B1)gives 750Logic
One value when the test holds and another when it does not. Without if_false, a failed test gives FALSE.
=IF(B1>1000, "large", "small")gives largeTRUE when every test holds.
=AND(B1>1000, C1="open")gives TRUETRUE when any test holds.
=OR(C2="open", D2>5)gives FALSEThe opposite of the test.
=NOT(C2="open")gives TRUEThe value, or the fallback when the value is an error such as #DIV/0! or #N/A.
=IFERROR(B1/0, 0)gives 0Text
Joins its arguments into one piece of text.
=CONCAT(A1, " (", C1, ")")gives Late delivery (open)The same as CONCAT, under the name older spreadsheets use.
=CONCATENATE(C3, "-", D3)gives open-3How many characters the text has, spaces included.
=LEN(A2)gives 13The first characters of the text; one when no count is given.
=LEFT(A3, 5)gives WrongThe last characters of the text; one when no count is given.
=RIGHT(A4, 5)gives partsCharacters from the middle of the text, counting the first character as 1.
=MID(A1, 6, 8)gives deliveryThe text without spaces at either end, and with every run of spaces inside it made one.
=TRIM(A5)gives Refund delayThe text in capitals.
=UPPER(C1)gives OPENThe text in small letters.
=LOWER(A2)gives damaged goodsLookup
Finds the first cell in lookup_range equal to lookup and returns the cell in the same position of return_range. Without if_not_found, a miss is #N/A. Both ranges are named, so inserting a column never changes the answer.
=XLOOKUP("Wrong item", A1:A6, B1:B6)gives 800The position of lookup in the range, counting from 1. match_type 0 finds an exact match (text may use * and ?); 1, the default, finds the last value at most lookup in an ascending range; -1 the last at least lookup in a descending one. A miss is #N/A.
=MATCH("Wrong item", A1:A6, 0)gives 3The cell at that row and column of the range, counting from 1. Paired with MATCH it looks up by position. A position outside the range is #REF!.
=INDEX(A1:A6, MATCH(800, B1:B6, 0))gives Wrong itemDate
Today's date in UTC, written as year-month-day. It changes by itself each day.
=TODAY()gives today’s date, as year-month-dayThe date for a year, month and day, written year-month-day. A month past 12 or a day past the month's end rolls forward, as in Excel.
=DATE(2026, 2, 30)gives 2026-03-02The year of a date written year-month-day, or of a date serial number.
=YEAR("2026-10-10")gives 2,026The month of a date, from 1 to 12.
=MONTH("2026-10-10")gives 10The day of the month of a date, from 1 to 31.
=DAY("2026-10-10")gives 10The last day of the month that many months after start's month; 0 is start's own month and a negative number counts back.
=EOMONTH("2026-01-15", 1)gives 2026-02-28Whole years ("Y"), months ("M") or days ("D") from start to end; "YM", "MD" and "YD" give what is left past whole years or months. An end before the start is #NUM!.
=DATEDIF("2025-03-15", "2026-10-10", "M")gives 18Statistics
The middle number, or the mean of the middle two when there is an even count.
=MEDIAN(B1:B6)gives 800The number that appears most often; among ties, the one that appears first. #N/A when no number repeats.
=MODE(B1:B6)gives 450The variance of a sample: the squared distances from the mean, divided by one less than the count.
=VAR(D1:D6)gives 8.3The variance of a whole population: divided by the count itself.
=VARP(D1:D6)gives 6.9167The standard deviation of a sample: the square root of VAR.
=ROUND(STDEV(D1:D6), 3)gives 2.881The standard deviation of a whole population: the square root of VARP.
=ROUND(STDEVP(D1:D6), 3)gives 2.63The value below which a share k of the numbers fall, k between 0 and 1, interpolating between neighbours as Excel's PERCENTILE.INC does. A k outside 0 to 1 is #NUM!.
=PERCENTILE(B1:B6, 0.9)gives 1,980A quartile: 0 is the minimum, 1 the first quartile, 2 the median, 3 the third quartile and 4 the maximum.
=QUARTILE(B1:B6, 1)gives 450How closely two columns move together, from -1 to 1, over the rows where both hold a number.
=ROUND(CORREL(B1:B6, D1:D6), 3)gives 0.996Conditional
How many cells meet the criterion: a value ("open"), a comparison (">500", "<>closed"), a pattern with * and ? ("Wr*"), or "" for blank. Text is matched without regard to case.
=COUNTIF(C1:C6, "open")gives 3Adds the cells of sum_range whose partners in range meet the criterion. Without sum_range, adds the matching cells themselves.
=SUMIF(C1:C6, "open", B1:B6)gives 4,500The mean of the cells whose partners meet the criterion; #DIV/0! when none do.
=AVERAGEIF(B1:B6, ">500")gives 1,500How many cells in the range are blank. A cell of only spaces counts as blank.
=COUNTBLANK(A1:B6)gives 2How many positions meet every criterion at once, each read as COUNTIF reads it. The ranges must be the same size.
=COUNTIFS(C1:C6, "open", B1:B6, ">1000")gives 2Adds the cells of sum_range at the positions meeting every criterion.
=SUMIFS(B1:B6, C1:C6, "open", D1:D6, ">3")gives 3,700The mean of average_range at the positions meeting every criterion; #DIV/0! when none do.
=AVERAGEIFS(D1:D6, C1:C6, "closed")gives 1.5When a formula fails
A failed formula shows why in the cell, in Excel’s words, so it can be searched for.
- #DIV/0!
- Divided by zero, or an average of nothing.
- #VALUE!
- A value of the wrong kind, or the wrong number of arguments.
- #NAME?
- A function or a range name this sheet does not have.
- #REF!
- A reference to a cell that is not there.
- #NUM!
- A number out of range, such as a percentile above 1.
- #N/A
- A lookup that found nothing, or a mode with no repeats.
- #CYCLE!
- A formula that depends on itself.