How to Insert a Formula in a Spreadsheet
In this article
To insert a formula in a spreadsheet, click the cell where you want the result, type an equals sign (=), then type your calculation using cell references (like =A1+B1) or a built-in function (like =SUM(A1:A10)), and press Enter. That is the whole core action. The rest of this guide covers doing it reliably in Excel, Google Sheets, and LibreOffice Calc, plus the mistakes that make a formula show as text or throw an error.
What You'll Need
- A spreadsheet app: Microsoft Excel, Google Sheets, or LibreOffice Calc. The steps below work in all three unless noted.
- A file with at least a few numbers in it, so you have something to reference.
- On mobile, the Excel or Google Sheets app installed from the official App Store or Google Play Store.
Step-by-Step
- Click the result cell. Pick an empty cell where the answer should appear, not a cell that already holds data you want to keep. A single click selects it; the cell reference (for example C2) shows in the Name Box at the top left of Excel.
- Type the equals sign. Press the = key. This tells the spreadsheet "what follows is a calculation, not text." If you skip it, the app stores your entry as plain text.
- Enter the calculation or function. Two ways work:
- Direct arithmetic: type cell references and operators, e.g. =A1+B1, =A2*B2, or =(A1+B1)/2. Operators are + (add), - (subtract), * (multiply), / (divide), and ^ (exponent).
- Built-in functions: type the function name and an opening parenthesis, e.g. =SUM(, then select the range with your mouse or type it, e.g. =SUM(A1:A10), and close the parenthesis. Common starters are SUM, AVERAGE, MIN, MAX, and COUNT.
- Point at cells instead of typing references. While the formula is still being edited, click a cell to insert its reference automatically. Type the operator, click the next cell, and repeat. This avoids typos in references like B17 versus B71.
- Close every parenthesis. If you used a function, make sure each opening bracket has a matching closing one. Excel and Google Sheets will usually offer to fix a missing parenthesis when you press Enter; accept only if the highlighted correction looks right.
- Press Enter (or Return). The formula is calculated and the result appears in the cell. The formula itself stays visible in the formula bar at the top when the cell is selected. In Google Sheets on a computer, Enter confirms and moves down; Ctrl+Enter (Cmd+Enter on Mac) keeps the cursor in the same cell.
- Copy the formula down a column if needed. Select the cell with the formula, then drag the small square handle at the bottom-right corner down over the rows you want to fill. Relative references adjust automatically (A1 becomes A2, A3, and so on). Use $ to lock a reference if it must not shift, e.g. =A2*$B$1.
- Check the result against one manual calculation. Pick one row and work it out yourself. If the formula result matches, the structure is correct and you can trust the fill-down.
Menu labels can differ slightly by app version, device, and region. On mobile, the process is the same: tap the cell, tap the formula or text entry area, type = and the calculation, then confirm. The function list is usually behind a symbol such as fx or a function icon.
Common Mistakes
- Forgetting the equals sign. Typing A1+B1 without = stores the literal text "A1+B1". Delete it and retype with = in front.
- Typing numbers instead of references. =5+3 works once but never updates. =A1+B1 recalculates whenever A1 or B1 changes, which is the point of a spreadsheet.
- Leaving a space inside a function name or range. =SUM (A1:A10) with a space can fail or behave unexpectedly. Write =SUM(A1:A10).
- Using the wrong range separator. Most English-language setups use a comma between function arguments, but some regional settings use a semicolon. If a formula with commas errors, try semicolons.
- Referencing text cells in arithmetic. =A1+B1 where A1 contains a word returns an error. Check that referenced cells hold numbers, not labels.
- Overwriting the formula with its result. If you type a number over a formula cell, the calculation is gone. Undo immediately with Ctrl+Z (Cmd+Z on Mac).
- Circular references. A formula that refers to its own cell, directly or through a chain, cannot calculate. The app will warn you; trace which cell points back to itself and break the loop.
Tips
- Use the formula bar to edit long formulas; it shows the full text even when the cell is too narrow.
- Start typing a function name and pause: Excel and Google Sheets show an autocomplete list with the function's arguments. Press Tab to accept.
- Double-click the fill handle to copy a formula down to the end of the adjacent data column, which is faster than dragging on long sheets.
- Wrap a formula in IFERROR to replace ugly error codes with a blank or a message, e.g. =IFERROR(A1/B1,"").
- Select part of a formula in the formula bar and press F9 (Excel) to see that part's calculated value; press Esc to return without changing anything.
- Keep one formula per column and fill it down rather than typing different versions row by row; consistency makes errors obvious.
Troubleshooting
- The formula shows as text. The cell is probably formatted as Text. Select it, set the format to General or Number, then re-enter the formula (changing the format alone may not recalculate an existing entry).
- #NAME? error. A function name is misspelled or a named range does not exist. Check the spelling against the autocomplete list.
- #REF! error. A referenced cell was deleted or moved. Edit the formula and reselect the range.
- #DIV/0! error. You are dividing by zero or by an empty cell. Guard it with IFERROR or check the divisor.
- Results do not update. In Excel, check that calculation is set to Automatic (Formulas tab > Calculation Options). In Google Sheets, recalculation is automatic; if values look stale, reload the page.
- Nothing happens when you press Enter. Make sure you are editing the cell and not a comment or a text box, and that the sheet is not protected. Unlock it via the sheet's protection settings if you own the file.
- If that did not work, copy the formula into a brand-new blank sheet with two or three test numbers. If it calculates there, the problem is in the original data (text-formatted numbers, hidden characters, or a broken reference), not in the formula syntax.
Frequently Asked Questions
Do I always need the equals sign?
Yes, for a calculation. Without =, the app treats your entry as text or a date. A leading + or - can also start a formula in some apps, but = is the reliable choice.
What is the difference between a formula and a function?
A formula is any calculation you write. A function is a built-in named operation, such as SUM or AVERAGE, that you use inside a formula. =SUM(A1:A5) is a formula that uses a function.
Can I insert a formula without typing it?
Yes. Use the function button (often labeled fx) next to the formula bar to pick a function from a list, then fill in its arguments in the dialog. This is helpful for functions with many arguments.
Why does my formula reference change when I copy it?
References are relative by default, so they shift with the copy. Add dollar signs to lock a row or column, e.g. $A$1, and the reference stays fixed.
Can I use a formula across multiple sheets?
Yes. Reference another sheet by name, e.g. =Sheet2!A1 in Excel and Google Sheets. If the sheet name contains spaces, wrap it in single quotes, e.g. ='Monthly Data'!A1.
Does inserting a formula work the same on a phone?
The logic is identical, but the interface is condensed. Tap the cell, tap the formula entry area, type = and the calculation, then confirm. Function lists and range selection are available but laid out differently from the desktop version.