The most direct answer: an XLS calculation formula is any instruction you type into an Excel cell that begins with an equals sign (=) and performs a calculation, such as =A1+B1 or =SUM(A1:A10). For example, typing =2+2 into a cell returns 4, and typing =SUM(B2:B6) adds all numbers in that range.
What Exactly Is an XLS Formula?
An XLS file (the classic Excel workbook format from Excel 97–2003) stores data in a grid of cells. A formula is a user-defined expression that Excel evaluates to produce a result. Unlike a static value like 42, a formula recalculates whenever the data it references changes. Every formula must start with =; if you omit it, Excel treats the text as a literal string.
Formulas can contain:
- Numbers – e.g.,
=5*3 - Cell references – e.g.,
=A1or=B2:C4 - Operators –
+(addition),-(subtraction),*(multiplication),/(division),^(exponentiation) - Functions – pre-built tools like
SUM,AVERAGE,IF, andVLOOKUP - Text strings – enclosed in double quotes, e.g.,
="Total: "&A1
In Excel for Microsoft 365 (Windows), formulas are typed directly into the cell or the formula bar. On Mac, the process is identical; the only difference is that some keyboard shortcuts differ (e.g., Cmd instead of Ctrl).
How to Write a Basic Formula: Step by Step
- Click the cell where you want the result.
- Type
=to start the formula. - Enter the expression. For example, to add the values in A1 and B1, type
=A1+B1. - Press Enter (Windows) or Return (Mac). Excel calculates and displays the result.
- To edit, double-click the cell or press F2 (Windows) / Ctrl+U (Mac).
Example: Suppose you have numbers 10 in A1 and 5 in B1. Typing =A1*B1 returns 50. If you later change A1 to 20, the result updates to 100 automatically.
Common Functions and Real-World Examples
Functions are pre-defined formulas that simplify complex calculations. Here are the most useful ones, with a concrete layout example.
SUM – Adds a range. With values in A2:A10, =SUM(A2:A10) returns the total. If A2:A10 contains 1,2,3,4,5,6,7,8,9, the result is 45.
AVERAGE – Calculates the mean. With the same range, =AVERAGE(A2:A10) returns 5.
IF – Returns one value if a condition is true, another if false. With a score in B2, =IF(B2>=60,"Pass","Fail") returns “Pass” if B2 is 60 or higher, otherwise “Fail”.
VLOOKUP – Searches for a value in the first column of a table and returns a value in the same row from a specified column. With a product ID in D2 and a table in A2:B10 (IDs in column A, prices in column B), =VLOOKUP(D2,A2:B10,2,FALSE) returns the price for that ID. Note: VLOOKUP works in all Excel versions, but XLOOKUP (Excel 2021/365) is more flexible.
COUNTIF – Counts cells that meet a condition. With names in A2:A20, =COUNTIF(A2:A20,"John") counts how many times “John” appears.
For money math, always double-check the arithmetic. For example, a simple interest calculation: principal in B2, annual rate in B3 (as a decimal, e.g., 0.05 for 5%), and years in B4. The formula =B2*B3*B4 gives the interest. If B2=1000, B3=0.05, B4=3, the result is 150. This is illustrative only; for real loans or investments, check terms with a lender or financial professional.
How to Choose the Right Formula
Selecting the correct formula depends on what you need to do:
- Add or average numbers – use
SUMorAVERAGE. - Look up a value – use
VLOOKUP(orXLOOKUPif you have Excel 2021/365). - Conditional logic – use
IF(orIFSfor multiple conditions). - Count or sum with criteria – use
COUNTIF,SUMIF, or their plural versionsCOUNTIFS,SUMIFS. - Find the largest or smallest – use
MAXorMIN.
When in doubt, start with the simplest function. For example, to add two cells, =A1+B1 is fine; to add a large range, =SUM(A1:A100) is more efficient and less error-prone.
Common Problems and How to Fix Them
Formulas often return errors. Here are the most frequent and their fixes:
- #VALUE! – A formula references text where a number is expected. Check that all referenced cells contain numbers, not text.
- #DIV/0! – You tried to divide by zero. For example,
=A1/B1when B1 is empty or 0. Use=IFERROR(A1/B1,0)to show 0 instead. - #NAME? – Excel doesn’t recognize a function name. Check spelling; e.g.,
SUMMis invalid. - #REF! – A referenced cell was deleted. Rebuild the formula or undo with Ctrl+Z (Windows) / Cmd+Z (Mac).
- Circular reference – A formula refers to its own cell, e.g., putting
=A1+1in A1. Excel warns you; remove the self-reference.
Another common mistake: forgetting the equals sign. If you type A1+B1 without =, Excel treats it as text. Also, when copying formulas, relative references change (e.g., =A1+B1 copied down becomes =A2+B2). To keep a reference fixed, use absolute references with dollar signs, like =$A$1.
Formula vs. Function: What’s the Difference?
People often use the terms interchangeably, but they are distinct. A formula is any expression that starts with =, including simple arithmetic like =A1*2. A function is a predefined formula built into Excel, such as SUM or IF. A formula can use a function, as in =SUM(A1:A10)+5, which adds the sum of A1:A10 and then adds 5. Understanding this helps when reading documentation: “use the SUM function” means type =SUM(...), not just SUM(...).
Safety and Accuracy Tips
Spreadsheet errors can have real consequences, especially in budgeting or data analysis. Follow these practices:
- Always verify the result – Manually calculate a small example to confirm the formula works.
- Use absolute references when needed – For example, if you have a tax rate in cell B1 and amounts in A2:A10, use
=A2*$B$1and copy down; the$B$1stays fixed. - Check for hidden rows or columns –
SUMignores text but includes hidden cells; if you hide rows, they are still summed. UseSUBTOTALif you want to exclude hidden rows. - Be careful with decimal places – Excel may show rounded numbers but store full precision. Use
ROUNDto avoid discrepancies:=ROUND(A1*B1,2)rounds to two decimals. - Never overwrite original data – Put formulas in separate cells, and keep a backup copy of your workbook before making major changes.
For financial calculations, remember that Excel is a tool, not a financial advisor. Always verify loan terms, interest rates, and tax rules with a qualified professional.
Frequently Asked Questions
How do I add a column of numbers in Excel?
Click the cell below the column, then type =SUM(A1:A10) (adjust the range to your data) and press Enter. Alternatively, select the cell and press Alt+= (Windows) or Cmd+Shift+T (Mac) to insert a SUM automatically.
Why is my formula showing as text?
Most likely you forgot the equals sign. Type = at the beginning. Also, check that the cell is not formatted as Text (Home > Number Format > General). If it is, change the format and re-enter the formula.
What does #N/A mean in VLOOKUP?
It means the lookup value was not found in the first column of the table. Double-check the value for typos, and ensure the range is correct. Using FALSE for exact match is usually what you want.
Can I use a formula across different sheets?
Yes. Reference another sheet by name, e.g., =Sheet2!A1 adds the value from cell A1 on Sheet2. If the sheet name has spaces, use single quotes: ='My Sheet'!A1.
How do I calculate percentages in Excel?
To find what percentage one number is of another, divide and format as percent. For example, if A1=20 and B1=50, =A1/B1 returns 0.4. Then select the cell and click Home > Number Format > Percent (or press Ctrl+Shift+% on Windows / Cmd+Shift+% on Mac) to display 40%.
What is the difference between XLS and XLSX?
XLS is the older Excel 97–2003 format; XLSX is the modern format (Excel 2007 and later). Formulas work the same in both, but XLSX supports more rows, columns, and features. If you open an XLS file in modern Excel, it works fine, but you may lose some newer functionality.
Related
- Free Online Data Entry Software: Real Options for 2025
- Google Sheets Power Query Equivalent: 6 Ways
- Project Stickley Hall Table: Plans & Build Guide
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- How to Filter Dates in ExcelTo filter dates in Excel for Microsoft 365 on Windows, select a cell in your data, choose Data…
- Excel Formula for Weekday: Get Day of WeekThe core Excel formula for a weekday is =WEEKDAY(date), which returns a number from 1 (Sunday) to 7…
- How to Add Filter Options in Excel: A Step-by-Step GuideTo add filter options in Excel for Microsoft 365 on Windows, select a cell in your data, then…
- What Is Functions in MySQL? Definition & UseIn MySQL, a function is a stored program that accepts arguments, performs a calculation or operation, and returns…
- Excel TEXT Function Format Codes ExplainedExcel TEXT format codes are patterns you pass to the TEXT function to turn a number, date, time,…
- Excel Wildcard SUMIF Formula Examples That Match TextTo total values for text that contains a word, use SUMIF with asterisks around the word: with product…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.