Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Google Sheets Formulas: How to Write Your First One

· 6 min read · Home Tech

In this article
  1. Why Formulas Start With an Equals Sign
  2. Basic Arithmetic Operators You Can Use
  3. Using Functions for Common Tasks
  4. How to Choose the Right Formula
  5. Common Formula Errors and Fixes
  6. Referencing Other Sheets and Files
  7. Absolute vs. Relative References
  8. Frequently Asked Questions

To write a formula in Google Sheets, click any cell, type an equals sign (=), then type the formula, such as =A2+B2 or =SUM(A2:A10), and press Enter. The cell will display the calculated result, while the formula itself appears in the formula bar above the grid.

Why Formulas Start With an Equals Sign

The equals sign tells Google Sheets that what follows is a calculation, not plain text. If you type 2+2 without the equals sign, Sheets treats it as the literal text "2+2." With =2+2, the cell shows 4. This rule applies to every formula, whether it uses numbers, cell references, or functions.

Cell references are the core of spreadsheet formulas. Instead of typing values directly, you point to cells. For example, if cell A1 contains 10 and B1 contains 5, the formula =A1*B1 returns 50. If you later change A1 to 20, the formula automatically recalculates to 100. This live updating is what makes formulas powerful for budgets, schedules, and data analysis.

Basic Arithmetic Operators You Can Use

Google Sheets supports the standard math operators, and you can combine them in one formula. The order of operations follows standard math rules: parentheses first, then exponents, then multiplication/division, then addition/subtraction.

  • + addition — =A1+B1
  • - subtraction — =A1-B1
  • * multiplication — =A1*B1
  • / division — =A1/B1
  • ^ exponentiation — =A1^2 squares the value in A1

Example: with A1=10, B1=5, and C1=2, the formula =(A1+B1)*C1 returns 30 because the parentheses force addition first. Without them, =A1+B1*C1 returns 20 (multiplication first).

Using Functions for Common Tasks

Functions are pre-built formulas that handle specific jobs. You type the function name followed by parentheses, with arguments inside separated by commas. The most common ones:

  • =SUM(A1:A10) — adds all numbers in the range A1 through A10
  • =AVERAGE(A1:A10) — returns the mean of the range
  • =COUNT(A1:A10) — counts how many cells contain numbers
  • =MAX(A1:A10) — returns the largest value
  • =MIN(A1:A10) — returns the smallest value

Ranges are written with a colon between the start and end cell, like A1:A10 for a column or A1:C1 for a row. You can also reference entire columns, such as =SUM(A:A), which adds every number in column A. Be careful with whole-column references on large sheets because they can slow down calculations.

How to Choose the Right Formula

Start by asking what you want the result to be. If you need a total, use SUM. If you need to count text entries, use COUNTA (which counts non-empty cells) instead of COUNT (which only counts numbers). For conditional totals, use SUMIF or SUMIFS.

Example: with sales amounts in B2:B20 and regions in A2:A20, the formula =SUMIF(A2:A20, "East", B2:B20) adds only the sales where column A says "East." The criteria text goes in quotes. For multiple conditions, =SUMIFS(B2:B20, A2:A20, "East", C2:C20, ">100") sums sales where region is East and the value in C is greater than 100.

When you are unsure what function exists, click the Functions icon (the Greek sigma symbol) in the toolbar, or go to Insert > Function. Sheets shows a searchable list with brief descriptions. You can also type = and start typing a function name; Sheets suggests matches and shows a short help tooltip.

Common Formula Errors and Fixes

Errors appear in the cell and often start with a hash symbol. Here are the most frequent ones:

  • #DIV/0! — you tried to divide by zero. Check the divisor cell; it may be empty, which Sheets treats as zero.
  • #VALUE! — a function expected a number but got text, or you used the wrong argument type.
  • #REF! — a referenced cell or range was deleted or moved.
  • #NAME? — Sheets does not recognize the function name, often due to a typo or missing quotes around text.
  • #N/A — a lookup function (like VLOOKUP) could not find the search key.

To debug, click the cell with the error and look at the formula bar. Check that every opening parenthesis has a closing one, that commas separate arguments, and that text is inside double quotes. Sheets also highlights matching parentheses in different colors as you edit.

Referencing Other Sheets and Files

You can pull data from another sheet in the same spreadsheet by using the sheet name followed by an exclamation mark. For example, if you have a sheet named "Expenses," the formula =Expenses!B2 returns the value in B2 of that sheet. If the sheet name contains spaces, wrap it in single quotes: ='Monthly Expenses'!B2.

For data in a different spreadsheet file, use =IMPORTRANGE("spreadsheet_url", "Sheet1!A1:B10"). The first argument is the full URL of the source file, and the second is the range in quoted format. The first time you use it, Sheets asks you to allow access to that external file. This function is useful for combining data from multiple team files, but it requires the source file to remain accessible.

Absolute vs. Relative References

When you copy a formula to another cell, references change relative to the new location. For example, if you type =A1*B1 in C1 and copy it to C2, it becomes =A2*B2. This is usually what you want. To keep a reference fixed, add dollar signs: =A$1*B1 keeps the row 1 fixed but lets the column change; =$A$1*B1 locks both the column and row.

Example: to multiply each value in B2:B10 by a tax rate in cell D1, write =B2*$D$1 in C2, then drag the fill handle (the small blue square at the bottom-right of the cell) down to C10. The B2 reference updates to B3, B4, etc., but D1 stays constant. Press F4 on Windows or Command+Shift+4 on Mac while editing a cell reference to cycle through the absolute/relative combinations.

Frequently Asked Questions

How do I see all formulas in my sheet? Press Ctrl+` (the backtick key, usually above Tab) on Windows, or Command+` on Mac, to toggle between showing formulas and showing results. You can also go to View > Show > Formulas.

Why is my formula showing as text? The most common cause is a missing equals sign at the start. If you typed SUM(A1:A10) without the =, Sheets treats it as text. Also check that the cell is not formatted as plain text (Format > Number > Automatic).

Can I use a formula across different tabs? Yes, use the sheet name with an exclamation mark, like =Sheet2!A1. If the sheet name has spaces, put it in single quotes: ='My Data'!A1.

What does the green triangle warning mean? A small green triangle in the top-left corner of a cell indicates a potential error, such as a formula that ignores adjacent cells or an inconsistent formula in a column. Click the cell to see the warning and choose to fix or ignore it.

How do I stop a formula from recalculating? Formulas recalculate automatically when their inputs change. To freeze the current value, copy the cell, then right-click and choose Paste special > Paste values only. This replaces the formula with its result as static text.

What is the difference between Google Sheets and Excel formulas? Most basic functions and syntax are identical. Differences appear in newer functions: Google Sheets has QUERY, SPARKLINE, and IMPORTRANGE, which do not exist in Excel. Excel has XLOOKUP and FILTER (available in Excel 2021 or Microsoft 365), while Sheets uses VLOOKUP and FILTER as well but with slightly different argument orders for some functions. Keyboard shortcuts also differ, but core arithmetic and SUM/AVERAGE work the same.