How to Compute ROI in Excel: Step-by-Step
In this article
To compute ROI in Excel, subtract the cost of the investment from the total gain, then divide that result by the cost, and format the cell as a percentage. The formula is =(Gain - Cost) / Cost. Enter your gain in one cell, your cost in another, and point the formula at those two cells. That is the whole calculation. The rest of this guide covers setting it up cleanly, handling multiple investments, and avoiding the mistakes that make ROI numbers misleading.
What You'll Need
- Microsoft Excel on desktop (Windows or Mac) or Excel for the web. The steps below work the same across these versions; labels can differ slightly by version and region.
- Two numbers for each investment: the total cost (what you paid, including fees if you want a true figure) and the total gain (the final value or the money returned).
- Basic familiarity with entering data into cells and selecting a range.
Step-by-Step
- Set up your columns. In a blank sheet, type these headers in row 1: Investment in A1, Cost in B1, Gain in C1, and ROI in D1. Press Enter after each. This keeps the layout readable and makes the formula easy to copy later.
- Enter your data. In row 2, type the name of the investment in A2, the cost in B2, and the gain in C2. Enter numbers only, no currency symbols or commas, so Excel treats them as values. If you type $1,000, Excel may store it as text and the formula will fail.
- Write the ROI formula. Click D2 and type =(C2-B2)/B2 then press Enter. This subtracts the cost from the gain and divides by the cost. If B2 is 1000 and C2 is 1500, the result is 0.5, meaning a 50% return.
- Format the result as a percentage. With D2 selected, go to the Home tab and click the % button in the Number group. The cell now shows 50%. If you see 50.00%, use the Decrease Decimal button next to it to tidy the display.
- Copy the formula down. Click D2, then drag the small square at the bottom-right corner of the cell down to cover the rows you need. Excel adjusts the cell references automatically, so D3 uses row 3's numbers and so on.
- Check a result by hand. Pick one row and verify: gain minus cost, divided by cost. If the sheet says 25% and your manual check says 20%, a cell reference is probably pointing at the wrong row.
- Add a total row if you want an overall ROI. Below your last data row, label the row Total. Sum the Cost column with =SUM(B2:B10) and the Gain column with =SUM(C2:C10), adjusting the range to your data. Then compute the overall ROI with =(C11-B11)/B11, using your actual total row numbers. Do not average the individual ROI percentages; that gives a different and usually wrong figure.
- Handle a zero or blank cost. If a cost cell is empty or zero, the formula returns a division error. Leave those rows out of the calculation or enter the real cost, because ROI is undefined without a cost.
Common Mistakes
- Dividing by the gain instead of the cost. ROI is always gain minus cost, divided by cost. Swapping the denominator inflates or deflates the result.
- Using profit as the gain. The gain in this formula is the total amount returned, not the profit. If you already subtracted the cost to get profit, you are double-counting. Either use total gain and total cost, or use profit divided by cost without subtracting again.
- Leaving numbers as text. Cells that look like numbers but are stored as text produce errors or zero results. Select the column, and if Excel flags the cells, use the warning icon to convert them to numbers.
- Averaging percentages across investments. The average of 100% and 10% is not the ROI of the combined investment. Use total gain and total cost for a portfolio figure.
- Forgetting fees and taxes. A ROI that ignores transaction costs overstates the return. Add them to the cost column for a realistic number.
Tips
- Use cell references rather than typed numbers inside the formula, so you can change the inputs without rewriting anything.
- Apply currency formatting to the Cost and Gain columns and percentage formatting to the ROI column. Mixing formats is the most common reason a sheet looks wrong when the math is right.
- If you want to compare investments of different sizes, ROI alone is not enough; a small investment with a high percentage can return less money than a large one with a modest percentage.
- Keep a notes column for assumptions such as the time period. ROI does not account for how long the money was tied up, so two 20% returns over one year and five years are not equivalent.
- Use Ctrl+` (the key left of 1) to toggle formula view and check that every ROI cell points where you expect.
Troubleshooting
- You see #DIV/0! The cost cell is blank or zero. Fill in the cost or exclude the row.
- You see #VALUE! One of the referenced cells contains text. Clear the cell and retype the number without symbols.
- The result is a decimal like 0.5 instead of 50%. The formula is correct; the cell is formatted as General. Apply percentage formatting.
- The percentage looks absurd, such as 10000%. Check whether the gain column already has the cost subtracted, or whether a decimal was entered as a whole number.
- Copied formulas give wrong results. The references may have shifted. Check one cell and, if needed, use absolute references with dollar signs, such as =(C2-$B$2)/$B$2, when a value should stay fixed.
- If that did not work, rebuild the formula in a fresh cell with two known numbers to confirm the syntax, then copy it back.
Frequently Asked Questions
What is the exact ROI formula in Excel?
=(Gain - Cost) / Cost. Replace Gain and Cost with the cell references holding your numbers, then format the result as a percentage.
Can I calculate ROI for several investments at once?
Yes. Put each investment on its own row with cost and gain columns, enter the formula once, and copy it down. For an overall figure, sum the cost and gain columns and apply the same formula to the totals.
Why does my ROI show a negative number?
A negative result means the gain is less than the cost, so the investment lost money. That is correct behaviour, not an error.
Does ROI account for time?
No. Basic ROI ignores how long the money was invested. If timing matters, compare returns over equal periods or use a time-adjusted measure instead.
Should I include fees in the cost?
Yes, if you want a realistic figure. Add transaction fees, commissions and taxes to the cost column before calculating.
Can I use this formula in Google Sheets?
Yes. The same formula and percentage formatting work in Google Sheets and most spreadsheet apps.