Smart Systems for Home

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

Excel Formulas: How to Write and Use Them

· 7 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Writing formulas in Excel allows you to perform calculations, analyze data, and automate repetitive tasks by telling the software exactly how to process the information in your cells. To write a formula, you simply click a cell, type an equals sign (=), and then enter a mathematical operation or a built-in function. This transforms a static cell into a dynamic calculator that updates automatically whenever the source data changes.

What You'll Need

  • A computer with Microsoft Excel installed (or access to Excel for the Web).
  • A basic dataset (numbers or text) entered into a worksheet to practice with.
  • A basic understanding of mathematical operators (addition, subtraction, multiplication, and division).

Step-by-Step

  1. Select the Target Cell: Click on the cell where you want the result of your calculation to appear. This is known as the formula cell.
  2. Start with the Equals Sign: Type the equals sign (=) into the cell. This is the most critical step; without the equals sign, Excel treats your entry as plain text or a date rather than a command to perform a calculation.
  3. Enter the First Reference or Value: You can either type a number directly (e.g., 10) or click on a cell that contains a number. Clicking a cell is preferred because it creates a "cell reference" (like A1), meaning if the number in A1 changes later, your formula result will update automatically.
  4. Insert a Mathematical Operator: Type the symbol for the operation you wish to perform. Excel uses the following standard operators:
    • Plus sign (+) for addition.
    • Minus sign (-) for subtraction.
    • Asterisk (*) for multiplication.
    • Forward slash (/) for division.
    • Caret (^) for exponents (powers).
  5. Enter the Second Reference or Value: Type another number or click another cell to complete the operation. For example, if you want to add cell A1 to cell B1, your formula would look like =A1+B1.
  6. Press Enter: Once the formula is complete, press the Enter key on your keyboard. The cell will now display the calculated result instead of the formula itself.
  7. Using Built-in Functions: For more complex tasks, use functions. Instead of typing =A1+A2+A3+A4+A5, you can type =SUM(A1:A5). To do this, type the equals sign, type the function name (like SUM, AVERAGE, or COUNT), open a parenthesis, select the range of cells with your mouse, close the parenthesis, and press Enter.
  8. Applying the Formula to Other Cells: If you have a column of data and want to repeat the same calculation for every row, click the small green square (the fill handle) in the bottom-right corner of your formula cell and drag it down the column. Excel will automatically adjust the cell references for each row.

Common Mistakes

One of the most frequent errors is forgetting the equals sign. If you type "10+10" into a cell and press Enter, Excel will simply display "10+10" as text. Always ensure the = symbol is the first character in the cell.

Another common mistake is the "Circular Reference." This happens when a formula refers to its own cell. For example, if you are writing a formula in cell A3 and you type =A1+A2+A3, you have created a loop. Excel cannot calculate a value that depends on itself, and it will usually trigger a warning message.

Incorrect Order of Operations is also a frequent pitfall. Excel follows standard mathematical rules (PEMDAS/BODMAS), meaning it performs multiplication and division before addition and subtraction. If you need to add two numbers before multiplying them, you must use parentheses. For example, =2+3*5 equals 17, but =(2+3)*5 equals 25.

Finally, many users struggle with "Hard-coding" values. Hard-coding is when you type a specific number into a formula (e.g., =A1*0.08 for tax) instead of putting that number in its own cell and referencing it (e.g., =A1*B1). Hard-coding makes your spreadsheet difficult to update; if the tax rate changes, you have to find and change every single formula instead of updating one single cell.

Tips

To see exactly what is happening inside a formula, use the "Formula Auditing" tools. You can double-click a cell to enter "Edit Mode," which highlights the referenced cells in different colors, making it easier to visualize the data flow.

Use Absolute References when you don't want a cell reference to change when you drag the fill handle. By default, references are "Relative," meaning they shift as you move the formula. To lock a reference, add a dollar sign before the column letter and row number (e.g., $B$1). You can quickly toggle this by pressing the F4 key while your cursor is on the cell reference in the formula bar.

Combine functions for more power. This is called "Nesting." For example, you can wrap an IF statement around a SUM function to say: "If the total sum of these cells is greater than 100, display 'Over Budget,' otherwise display 'Within Budget.'"

Utilize the "Insert Function" button (fx) located next to the formula bar. If you aren't sure which function to use or what arguments it requires, this tool provides a searchable database of all available Excel functions with descriptions of what they do.

Troubleshooting

If your formula isn't working, first check for common error codes. If you see #DIV/0!, it means your formula is trying to divide a number by zero or an empty cell. Check your divisor cell to ensure it contains a non-zero value.

If you see #VALUE!, Excel is encountering the wrong type of data. This often happens when a formula expects a number but finds text instead. Check for hidden spaces in your cells or ensure that numbers aren't formatted as text.

The #NAME? error typically means there is a typo in the function name. For instance, typing =SUMM(A1:A10) instead of =SUM(A1:A10) will trigger this error because Excel doesn't recognize "SUMM" as a valid command.

If you see #REF!, it means a cell reference is no longer valid. This usually happens if you delete a column or row that was being used by a formula. To fix this, you will need to rewrite the formula to reference an existing cell.

If the cell simply shows the formula text (e.g., it shows =A1+B1 instead of the result), check the cell formatting. If the cell is formatted as "Text," Excel will not execute the formula. Change the cell format to "General," then click into the formula bar and press Enter again to force the calculation.

Frequently Asked Questions

How do I add a long column of numbers quickly?

The fastest way is to use the AutoSum feature. Select the empty cell at the bottom of your column and click the "AutoSum" button on the Home tab, or press Alt + = on your keyboard. Excel will automatically suggest a range to sum; press Enter to confirm.

What is the difference between a formula and a function?

A formula is any equation you write yourself (e.g., =A1+B1). A function is a pre-defined formula built into Excel (e.g., =SUM(A1:B1)). All functions are formulas, but not all formulas use functions.

How can I make a formula ignore blank cells?

Most built-in functions like SUM and AVERAGE automatically ignore blank cells. However, if you are using a custom formula and want to avoid errors from blanks, you can use the IFERROR function to tell Excel what to display (like a 0 or a blank space) if the calculation fails.

Can I use formulas to combine text from two cells?

Yes. You can use the ampersand symbol (&) to join text. For example, if cell A1 has "John" and B1 has "Doe," the formula =A1 & " " & B1 will result in "John Doe". The " " adds a space between the two names.

How do I stop a formula from updating?

If you want to keep the current result of a formula but remove the underlying calculation, copy the cell, right-click on it, and select "Paste Values." This replaces the formula with the static result, meaning it will no longer change if the source data is edited.

Why does my formula show as a series of hashtags (######)?

This isn't actually an error; it simply means the column is too narrow to display the result. Hover your mouse over the right border of the column header and double-click it to automatically resize the column to fit the data.