Microsoft Excel Formula by Example? Real Uses
In this article
Microsoft Excel formulas are expressions that perform calculations on your data, and you can learn them best by seeing real examples of how they work in everyday spreadsheets. This article walks you through several common formulas, explains how to build and edit them, and shows you how to choose the right one for your task.
What Is an Excel Formula?
An Excel formula is a sequence of values, cell references, operators, and functions that starts with an equals sign (=). When you type =A1+B1 into a cell, Excel adds the values in cells A1 and B1. If you change either input, the result updates automatically. Formulas are the backbone of Excel—they turn static numbers into a live, interactive worksheet.
Functions are pre-built formulas that simplify complex calculations. For example, SUM(A1:A10) adds all numbers in that range, and AVERAGE(B1:B10) finds their mean. You can combine functions, math operators, and cell references in a single formula like =SUM(A1:A10)/COUNT(A1:A10) to compute an average manually.
Anatomy of a Formula
Every formula has the same basic structure:
- Equals sign: Tells Excel that what follows is a formula, not text.
- Operands: Numbers, text, or cell references (like
A1orB2:B5). - Operators:
+(addition),-(subtraction),*(multiplication),/(division),^(exponentiation), and&(concatenation). - Functions: Named operations like
SUM,IF, orVLOOKUP. - Arguments: The inputs inside parentheses, separated by commas.
For example, =IF(D2>=60,"Pass","Fail") checks if the value in D2 is at least 60; if true, it returns "Pass", otherwise "Fail".
Common Formula Examples
Here are five formulas you will use repeatedly, with concrete examples:
- SUM: Add a range.
=SUM(B2:B10)adds all numbers in cells B2 through B10. Use it for totals, budgets, or scores. - AVERAGE: Find the mean.
=AVERAGE(C2:C10)returns the average of the range. Pair it withCOUNTto see how many values contributed. - IF: Make a decision.
=IF(A2>100,"High","Low")labels each row based on a condition. This is essential for grading, discounts, or flags. - VLOOKUP: Search for a value in the first column of a table and return a value from another column.
=VLOOKUP("Apple",A2:B10,2,FALSE)finds "Apple" in column A and returns the matching value from column B. Use it to merge data from separate lists. - COUNTIF: Count cells that meet a condition.
=COUNTIF(D2:D10,">60")counts how many values exceed 60. For multiple conditions, useCOUNTIFS.
These examples cover most everyday spreadsheet tasks: totaling, averaging, conditionally labeling, looking up data, and counting matches.
How to Build a Formula Step by Step
To create a formula in Excel:
- Click the cell where you want the result.
- Type an equals sign (
=) to start. - Enter the formula using cell references and functions. For example, type
=SUM(. - Select the range with your mouse, or type it manually (e.g.,
A1:A5). - Close the parentheses and press Enter.
To edit an existing formula, double-click the cell or select it and press F2. Use the formula bar at the top to see and modify the full formula. When editing, Excel color-codes cell references so you can see which cells are used.
If you're unsure which function to use, click the fx button next to the formula bar. It opens the Insert Function dialog, where you can search by description (e.g., "add numbers") and see a preview of the result.
Choosing the Right Formula
Selecting the correct formula depends on your goal:
- Add or total: Use
SUM. - Average, max, min: Use
AVERAGE,MAX,MIN. - Conditional logic: Use
IFfor simple true/false,IFSfor multiple conditions. - Look up a value: Use
VLOOKUP(vertical) orHLOOKUP(horizontal). For more flexibility,INDEXandMATCHare powerful alternatives. - Count with criteria: Use
COUNTIForCOUNTIFS. - Concatenate text: Use
&orCONCATENATE(nowCONCAT).
When in doubt, break your problem into smaller pieces. If you need a total of only sales above $500, combine SUMIF or SUMIFS. For example, =SUMIF(B2:B10,">500") adds only values over 500.
Common Mistakes and How to Fix Them
New users often run into these issues:
- Forgetting the equals sign: If you type
A1+B1without=, Excel treats it as text. Always start with=. - Mismatched parentheses: Every opening parenthesis needs a closing one. Excel shows a red error if the count is off. Use the formula bar to check.
- Using the wrong range: Double-check that your range includes all the cells you intend. A quick click on the range in the formula bar highlights the actual cells.
- Dividing by zero:
=A1/B1returns#DIV/0!if B1 is empty or zero. Use=IFERROR(A1/B1,0)to display a friendly message. - Relative vs. absolute references: When copying a formula down, cell references change (relative). To keep a reference fixed, use dollar signs:
$A$1(absolute). For example,=B2*$C$1multiplies each B value by the constant in C1.
If you see an error like #VALUE! or #NAME?, it usually means a function name is misspelled or you used text where a number is expected. Hover over the error icon for a hint.
Comparing Formulas vs. Functions
Formulas and functions are often confused, but they are distinct:
- Formula: Any expression you type that starts with
=, including simple arithmetic like=A1+A2. - Function: A predefined operation like
SUMorIFthat you call within a formula. A function is always part of a formula.
For example, =SUM(A1:A10) is a formula that uses the SUM function. You can also write =A1+A2+A3+... manually, but functions are faster and less error-prone for large ranges.
Frequently Asked Questions
How do I copy a formula down an entire column?
Select the cell with the formula, then drag the fill handle (the small square at the bottom-right corner) down over the cells you want to fill. Alternatively, double-click the fill handle to auto-fill down to the last adjacent data row. Excel adjusts relative references automatically.
Why does my formula show the same result for every row?
This usually happens when you used absolute references (e.g., $A$1) instead of relative ones. If you want each row to use its own value, remove the dollar signs. For example, change =B2*$C$1 to =B2*C1 if C1 should change per row.
What does #REF! mean in Excel?
The #REF! error appears when a formula references a cell that has been deleted or overwritten. To fix it, undo the deletion (Ctrl+Z) or edit the formula to point to a valid cell. If you copy a formula too far to the right, it may reference cells outside the worksheet, causing this error.
Can I use text in a formula?
Yes. Text must be enclosed in double quotes, like =IF(A1>0,"Positive","Negative"). You can also join text with the ampersand: =A1&" units" appends the word "units" to the value in A1.
How do I see all formulas in a worksheet?
Press Ctrl+` (the grave accent key, usually above Tab) to toggle between showing values and showing formulas. This is useful for auditing a spreadsheet. To print formulas, use the same toggle and then print.
What is the difference between VLOOKUP and INDEX/MATCH?
VLOOKUP searches for a value in the first column of a table and returns a value from a column to the right. INDEX/MATCH is more flexible: MATCH finds the position of a value, and INDEX returns the value at that position. INDEX/MATCH can search left or right and does not break when you insert columns. For most new work, INDEX/MATCH is recommended.