Field Guide

What is a formula in Excel?

Updated

A formula in Excel is an entry that calculates a value. Microsoft’s definition is compact: “Formulas are equations that perform calculations on values in your sheet.” Every formula begins with an equal sign; the = tells Excel to calculate what follows instead of storing it as characters. Type =2+3 into a cell and the cell shows 5. Leave the equal sign off, SUM(A1:A10) for instance, and Excel stores the text string SUM(A1:A10) with no calculation behind it. Microsoft’s own troubleshooting page calls the missing equal sign a common mistake.

The formula and its result live in different places on screen. The cell shows the calculated value; the formula itself appears in the formula bar at the top of the window whenever the cell is selected. The last section of this page is a map: when a formula misbehaves, it points you at the guide for that specific failure.

B5
fx
=SUM(B2:B4)
A B
1 Month Sales
2 Jan 1,200
3 Feb 950
4 Mar 1,400
5 Total 3,550
B5 is selected. The grid shows the result, 3,550; the formula bar above shows the formula that produced it, =SUM(B2:B4).

The parts of a formula

After the equal sign, a formula can contain any or all of four kinds of parts: functions, references, constants, and operators. One formula shows all four at once:

B6
fx
=SUM(B2:B4)*0.05+10

With the sales figures from the grid above, this returns 187.50: SUM adds B2:B4 to 3,550, times 0.05 is 177.50, plus 10 is 187.50.

Each of those parts, along with the wider vocabulary of workbooks, worksheets, cells, and ranges, gets a one-line definition in the Excel definitions glossary.

Order of operations: what Excel calculates first

When a formula combines several operators, Excel does not simply work left to right. It evaluates in a fixed order: reference operators first (the colon in a range like B2:B4, plus the comma and the single space), then negation (the minus in -1), percent, and exponentiation (^), then multiplication and division (* and /), then addition and subtraction (+ and -), then the & that joins text, and comparison operators last (=, <, >, <=, >=, <>). When operators share a precedence level (a formula with both a multiplication and a division, for example), Excel evaluates them left to right.

Microsoft’s example is the shortest demonstration: =5+2*3 returns 11, not 21, because the multiplication runs first and the addition second. Parentheses override the order: =(5+2)*3 forces the addition first and returns 21.

The same trap in a worksheet looks like this:

=B2+B3*1.05
Multiplication binds tighter than addition, so only the shipping in B3 of the grid below is multiplied by 1.05. The result is 210.50, and the 200.00 subtotal goes untaxed.
B4
fx
=(B2+B3)*1.05
A B
1 Item Amount
2 Subtotal 200.00
3 Shipping 10.00
4 Total with 5% tax 220.50
The parentheses make Excel add first: (200.00 + 10.00) × 1.05 = 220.50. Without them the formula returns 210.50.

When in doubt, add parentheses around the part you want calculated first. They cost nothing and they make the intent readable.

The formula bar

The formula bar sits at the top of the Excel window. Per Microsoft’s overview page, “When a formula is entered into a cell, it also appears in the Formula bar.” That is how you read a worksheet: the grid shows results, and to see the formula behind any result, you select the cell and read the bar.

The split matters because the grid alone cannot tell you where a number came from. A cell showing 3,550 might hold a typed constant or a calculation; both look identical in the grid. The formula bar is where you find out which one you are looking at.

Working in the bar:

Entering and editing a formula

The basic entry procedure is short: select the cell where you want the result, type = followed by the constants, references, and operators of your calculation, and press Enter (Return on a Mac). You can also point instead of typing: type =, select the first cell you want to include, type an operator such as +, then select the next cell, and Excel writes the references for you.

For the most common calculation of all, summing a column or row, you do not need to type anything: select a cell next to the numbers, select AutoSum on the Home tab, and press Enter. Excel proposes the range and writes the SUM formula.

To change an existing formula, select the cell and edit in the formula bar, or press F2 in Excel for Windows to edit in the cell.

When a formula goes wrong

If you looked this up because a formula is misbehaving, match the symptom; each failure mode has its own guide here.

A formula that shows itself, or will not update. A cell displaying =SUM(B2:B4) as text, or a total that ignores edits to its inputs, is the territory of why is my Excel formula not calculating: Text-formatted cells, Show Formulas mode, manual calculation, and stray characters before the equal sign. A close cousin hides on the input side: values that look like numbers but are stored as text, so calculations quietly skip them. Numbers stored as text covers spotting and fixing those.

An error value in the cell. A cell showing #REF!, #VALUE!, #NAME?, or #DIV/0! is calculating, and the calculation is failing; each error names its own cause, and Excel’s error values, explained walks through the vocabulary. The most common special case is a lookup returning #N/A because it cannot find a match, which has its own walkthrough in the VLOOKUP #N/A guide. If you are choosing a lookup in the first place, start with XLOOKUP or the VLOOKUP vs XLOOKUP comparison, and reach for INDEX and MATCH when the lookup column is not where VLOOKUP needs it.

Right formula, wrong cells. A copied formula that returns a plausible but wrong number usually had a relative reference shift when it moved; cell references in Excel covers when to lock a reference with dollar signs and when not to. Formulas that pull values from other tabs have their own syntax and their own failure modes, covered in referencing another sheet. And when a formula has grown into coordinate soup, named ranges replace $B$1 with a readable name.

Loops and spills. A formula that includes its own cell in its inputs, directly or through a chain of other cells, is a circular reference; circular references in Excel covers finding and fixing them. And a single formula that returns a whole set of values places them in the neighbouring cells, which Excel calls spilling; array formulas explains that behaviour and its failure modes.

Building logic, not fixing it. For a formula that chooses between outcomes, start with the IF function. For counting and adding with conditions, COUNTIF and SUMIF. When the arithmetic outgrows them, multiplying matching rows and summing the results, SUMPRODUCT is the tool. Joining text from several cells into one is the job of the ampersand and its function relatives, covered in concatenate in Excel; the reverse, pulling a piece back out of a string with LEFT, RIGHT, MID, and FIND, is extracting text in Excel; and formulas that compute with dates, TODAY, DATEDIF, WEEKDAY and the rest, are collected in Excel date functions.

Numbers and dates that look wrong. A value that displays rounded, or a column that will not add up to its own displayed total, is usually the display, not the data; how to stop Excel from rounding covers the fixes, and the ROUND function covers rounding the values on purpose. A date showing up as a five-digit number, or refusing to change format, is the territory of Excel date formats. And formatting a number or date into a label is the TEXT function’s job.

The short version

And when the question is not what a formula is but what changed between two versions of a workbook, compare the two files instead of reading formulas cell by cell.

Frequently asked questions

What is a formula in Excel?
A formula is an equation that performs a calculation on values in your sheet. It always begins with an equal sign, and after that it can contain any or all of four kinds of parts: functions such as SUM, cell references such as A2, constants such as 2 or 0.05, and operators such as + and *. The cell shows the calculated result; the formula bar shows the formula itself.
Do all Excel formulas start with an equal sign?
Yes. An entry that does not start with an equal sign is not a formula and is not calculated; Microsoft calls this a common mistake. Type SUM(A1:A10) without the equal sign and Excel shows the text string SUM(A1:A10) instead of a result.
What are the parts of an Excel formula?
A formula can contain any or all of four parts. Functions are built-in named calculations: PI() returns the value of pi. References fetch values from cells: A2 returns the value in cell A2. Constants are numbers or text values typed directly into the formula, such as 2. Operators say what to do with the values: the caret raises a number to a power, the asterisk multiplies.
What is the order of operations in Excel?
Excel evaluates reference operators first, then negation, percent, and exponentiation, then multiplication and division, then addition and subtraction, then the ampersand that joins text, and comparison operators last. Operators with the same precedence are evaluated left to right. So =5+2*3 returns 11, because multiplication runs before addition, and =(5+2)*3 returns 21, because parentheses force the addition to happen first.
What is the formula bar in Excel?
The formula bar is the strip at the top of the Excel window that shows the formula behind the selected cell while the cell itself shows the calculated result. Select any cell to see its formula there, and complete or cancel an edit from either the cell or the bar. In Excel for Windows, Ctrl+Shift+U expands or collapses the formula bar, which helps with long formulas.
What is the difference between a formula and a function?
A formula is the whole entry that starts with the equal sign. A function is a built-in, named calculation used inside a formula, such as SUM or PI. So =SUM(B2:B4) is a formula that uses the SUM function, and =B2+B3+B4 is a formula that uses no function at all.
Why does my formula show as text instead of a result?
Three usual causes: the entry does not start with an equal sign, the cell was formatted as Text before the formula was entered, or Show Formulas mode is switched on. Each cause has a specific fix, covered in the guide to formulas that are not calculating.

Catch the errors before they ship

Reviewing a change to a model? Compare the two versions in your browser and see every changed cell, formula, and value. It's free, and nothing leaves your computer.