An Excel formula starts with an equals sign and calculates a result from values, references or functions. Begin with a small dataset you can check manually. A formula that returns a number is not necessarily implementing the rule you intended.
The examples below use a fictional five-row table. Product names are in A2:A6, quantities in B2:B6, unit prices in C2:C6 and line totals in D2:D6. If your app uses different separators or function support, follow its version-specific guidance.
Start with arithmetic and a clear table
Use one header row and one meaning per column. Enter numbers as numeric values rather than text such as “12 dollars”. In D2, multiply quantity by unit price, then fill down.
For a test row with quantity 2 and price 12.50, the expected result is 25.00. Check that manually before extending the formula. If the answer is wrong on the smallest case, a bigger dataset will make the error harder to notice.
=B2*C2
Add totals and calculate an average
SUM adds the intended values. AVERAGE calculates the arithmetic mean of numeric values in its range. These answer different questions, and blank or text values can affect interpretation. Check what the range includes rather than copying a formula without looking at the cells.
If your line totals are 25, 6, 25, 20 and 39.50, SUM should return 115.50 and AVERAGE should return 23.10. A grand-total row should not accidentally include itself.
| Purpose | Formula |
|---|---|
| Total of line amounts | =SUM(D2:D6) |
| Average line amount | =AVERAGE(D2:D6) |
Use IF for a defined rule
Write the decision in words first. If totals of at least 100 should be labelled Large, the equality boundary matters. Test 99, 100 and 101. A formula using >100 would not follow the same rule as >=100.
Avoid hiding business decisions inside unexplained formulas. Put adjustable assumptions in labelled cells and document what a flag means. “Large” may mean an internal review threshold; it does not automatically mean a customer receives a discount.
=IF(D2>=100,"Large","Standard")
Count or sum matching records
COUNTIF counts cells meeting a condition. SUMIF adds corresponding values for a condition. If categories are in E2:E6, you can count Books rows or add their line amounts. Keep criterion and sum ranges aligned to the same records.
Check spelling and unwanted whitespace when categories split unexpectedly. A category count is not revenue, and the number of order lines is not necessarily the number of distinct orders.
=COUNTIF(E2:E6,"Books")
=SUMIF(E2:E6,"Books",D2:D6)
Understand references and lookups
Relative references normally move when copied. A reference such as $H$1 keeps the marked row and column fixed. If H1 contains a fictional 10% discount, =D2*(1-$H$1) keeps using that assumption as the formula fills down.
For supported Excel versions, XLOOKUP can retrieve a related value using a key. Use an explicit missing-match result, such as “Not found”, instead of silently returning a valid-looking category. Availability differs by version, so check support before sharing a workbook with colleagues.
=D2*(1-$H$1)
=XLOOKUP(A2,$G$2:$G$6,$H$2:$H$6,"Not found",0)
Check the workbook like a small system
Test ordinary values, boundaries and missing inputs. Compare a category summary with the overall total and inspect at least one copied formula. If a number looks suspicious, check the data type, referenced range and business rule before changing the result manually.
Keep a small test area with known answers. A workbook is easier to maintain when its owner can explain what each output means and show why it is correct. Colour and formatting can improve readability, but they do not substitute for those checks.
- A normal input with a known answer.
- A boundary such as exactly 100.
- A missing or invalid input.
- A copied formula on a later row.
- A total reconciled to the source.
Frequently asked questions
Why does a formula show as text?
The cell may be formatted as text or the entry may not be recognised as a formula. Inspect the cell format and actual entry rather than assuming the function is broken.
Should every error become zero?
No. Zero can conceal missing or invalid information. Choose an error-handling approach that reflects the business rule.
Does XLOOKUP work in every Excel version?
No. Check the version used by everyone who needs the workbook and choose a supported approach.
Sources and further reading
Prepared with AI assistance for AdvanceTech. Technical references checked in October 2026. Examples are illustrative; product screens and available options can change.
Related reading
- What Is Python? A Beginner’s Guide with a Small Working Example
- What Is an API? A Plain-English Guide for Small Businesses
Practise further: Excel Formulas for Work: IF, SUMIF and Lookups
