How to Calculate the Sharpe Ratio in Excel (and Sortino)
August 9, 2026 · Agenttrading · Last updated August 2026
- 1 THESIS
- 2 EVIDENCE
- 3 BACKTEST
- 4 RISK
- 5 VERDICT
02 EVIDENCE · FUNDAMENTALS
04 RISK · IN PLAIN ENGLISH
Past performance does not guarantee future results. Educational analysis only, not financial advice.
To calculate the Sharpe ratio in Excel, put your periodic returns in one column and use =(AVERAGE(B2:B61) - RF) / STDEV.S(B2:B61) * SQRT(N), where RF is the risk-free rate for that same period and N is the number of periods per year (12 for monthly returns, 252 for daily). That single formula is the whole calculation. Everything else is getting the inputs right.
Getting the inputs right is where most spreadsheets quietly go wrong. People mix an annual risk-free rate with monthly returns, use the population standard deviation when they meant the sample one, or annualize a figure that was already annual. Below is the exact method for monthly and daily data, a worked example you can copy, the Sortino variant, and the mistakes that produce a Sharpe ratio two or three times larger than the truth.
What is the formula for the Sharpe ratio?
The Sharpe ratio is excess return divided by volatility:
Sharpe ratio = (Rp - Rf) / standard deviation of Rp
Rp is the return of the portfolio or strategy, Rf is the risk-free rate over the same period, and the denominator is the standard deviation of those same returns. William F. Sharpe published it in 1966 as the reward-to-variability ratio and revised the definition in the Journal of Portfolio Management in 1994 to measure excess return over a chosen benchmark rather than a cash rate alone.
The critical detail is that all three inputs have to share a period. If your returns are monthly, the risk-free rate must be monthly and the standard deviation must be of monthly returns. You then scale the result to annual terms at the end, once.
The three formulas, by data frequency
| Your return data | Excel formula | Annualization factor |
|---|---|---|
| Annual returns | =(AVERAGE(range) - Rf_annual) / STDEV.S(range) | None, already annual |
| Monthly returns | =(AVERAGE(range) - Rf_annual/12) / STDEV.S(range) * SQRT(12) | SQRT(12) = 3.464 |
| Daily returns (trading days) | =(AVERAGE(range) - Rf_annual/252) / STDEV.S(range) * SQRT(252) | SQRT(252) = 15.875 |
| Weekly returns | =(AVERAGE(range) - Rf_annual/52) / STDEV.S(range) * SQRT(52) | SQRT(52) = 7.211 |
Notice that the risk-free rate is divided by the period count while the final ratio is multiplied by the square root of it. That asymmetry is not a typo. Returns scale roughly linearly with time, volatility scales with the square root of time, and the Sharpe ratio inherits the difference.
How to calculate the Sharpe ratio in Excel, step by step
- Put the returns in one column. Column A holds the dates, column B holds the period return as a decimal (0.0234 for 2.34%, not the number 2.34). If you only have prices, compute returns first with =B3/B2-1 and drag down.
- Put the annual risk-free rate in its own cell. Use a named cell such as E1 so the formula reads clearly and you can change the assumption without editing anything else. Enter it as a decimal: 0.038 for 3.8%.
- Compute the average period return. =AVERAGE(B2:B61) over the whole return series.
- Convert the risk-free rate to the same period. Divide by 12 for monthly data or 252 for daily. So =E1/12 for a monthly series.
- Compute the standard deviation. =STDEV.S(B2:B61) for a sample, which is what a historical return series almost always is.
- Divide and annualize. =(AVERAGE(B2:B61) - E1/12) / STDEV.S(B2:B61) * SQRT(12) gives the annualized Sharpe ratio from monthly returns.
If you want the whole thing in one cell without helper columns, that last formula is all you need. Keep the helper columns anyway the first few times, because a Sharpe ratio that comes out at 4.8 is almost always an annualization error and the intermediate numbers show you where.
A worked example with real numbers
Take a strategy with 60 months of returns averaging 0.95% per month, a monthly standard deviation of 3.6%, and a risk-free rate of 3.8% a year.
| Step | Calculation | Result |
|---|---|---|
| Average monthly return | AVERAGE of the 60 values | 0.0095 |
| Monthly risk-free rate | 0.038 / 12 | 0.003167 |
| Monthly excess return | 0.0095 - 0.003167 | 0.006333 |
| Monthly standard deviation | STDEV.S of the 60 values | 0.036 |
| Monthly Sharpe ratio | 0.006333 / 0.036 | 0.1759 |
| Annualized Sharpe ratio | 0.1759 x SQRT(12) | 0.61 |
A Sharpe ratio of 0.61 is a middling result, which is worth sitting with, because the underlying strategy returned about 12% a year. Strong returns and a modest Sharpe ratio go together whenever the ride is volatile, and that gap is exactly what the ratio exists to expose.
How do you calculate the Sharpe ratio from monthly returns?
Use =(AVERAGE(range) - annual_rf/12) / STDEV.S(range) * SQRT(12). Monthly data is the most common starting point because brokerage and fund statements are monthly, and 60 monthly observations is generally regarded as the practical minimum for a Sharpe ratio worth quoting. Fewer than about 36 and the standard deviation itself is too noisy to support the conclusion.
One caution specific to monthly data: monthly returns hide intra-month drawdowns completely. A strategy that fell 22% mid-month and recovered by the close will show a calm monthly series and an attractive Sharpe ratio, while the experience of holding it was nothing of the sort.
How do you calculate the Sharpe ratio from daily returns?
Use =(AVERAGE(range) - annual_rf/252) / STDEV.S(range) * SQRT(252). The 252 is the approximate number of US trading days in a year, and it is the standard convention. Do not use 365, which treats weekends as trading days and understates the annualized figure by roughly 24%.
Daily data gives you far more observations, which makes the standard deviation more stable, but it also introduces autocorrelation. If returns are serially correlated, the square-root-of-time scaling overstates the annualized Sharpe ratio. For most equity strategies the distortion is small enough to live with. For anything holding illiquid instruments or smoothed valuations, it is not.
Which risk-free rate should you use?
In the United States the standard choice is the 3-month Treasury bill, which yielded 3.80% on August 7, 2026. Two rules keep it honest. Match the currency of the rate to the currency of the returns, and use the rate that actually applied during the test window rather than today's rate.
That second rule matters more than people expect. Charge a 2026 cash rate of 3.8% against a backtest running through 2009 to 2021, when short rates sat near zero, and you have subtracted a cost the strategy never faced. The Sharpe ratio comes out materially lower than reality. Run it the other way, applying near-zero rates to a high-rate period, and it comes out flattering. If your window spans both regimes, use a monthly series of actual T-bill rates rather than a single constant.
STDEV.S or STDEV.P: which belongs in the denominator?
Use STDEV.S. Your return history is a sample drawn from a much larger set of possible outcomes, not the complete population, so the sample standard deviation with its n-1 denominator is the correct choice. STDEV.P treats your 60 months as the entire universe of what could have happened, which is not a claim anyone means to make.
The practical difference is small and shrinks as the series grows. On 60 observations, STDEV.P produces a standard deviation about 0.8% lower than STDEV.S, which nudges the Sharpe ratio up slightly. On 20 observations the gap widens to around 2.5%. It will not rescue a bad strategy, but if you are comparing your number against someone else's, knowing which function they used removes one source of disagreement.
How do you calculate the Sortino ratio in Excel?
The Sortino ratio replaces total volatility with downside deviation, so only losing periods count against you. There is no built-in Excel function, so build the denominator yourself with an array formula:
=(AVERAGE(B2:B61) - E1/12) / SQRT(SUMPRODUCT((B2:B61<0)*(B2:B61^2))/COUNT(B2:B61)) * SQRT(12)
The SUMPRODUCT term squares only the negative returns, sums them, and divides by the total number of observations, which gives the downside deviation against a zero threshold. If you prefer to measure downside against a minimum acceptable return instead of zero, replace the two references to B2:B61 inside SUMPRODUCT with (B2:B61-MAR).
One debate worth knowing about: some practitioners divide by the count of negative periods rather than the total count. Dividing by the total is the more common convention and the more conservative one, and it is what most published Sortino figures use. A strategy will always score higher on Sortino than on Sharpe unless its returns are perfectly symmetric, so comparing your Sortino against someone else's Sharpe is meaningless.
How do you calculate the Sharpe ratio for a portfolio in Excel?
Build a single blended return column first, then run the standard formula on it. In a new column, compute the weighted return for each period with =SUMPRODUCT(weights_range, returns_range_for_that_period), then apply the Sharpe formula to that column exactly as you would to a single asset.
Do not average the Sharpe ratios of the individual holdings. That discards the entire diversification effect, which is the main reason for holding a portfolio in the first place. Two assets each with a Sharpe ratio of 0.5 and low correlation can combine into a portfolio Sharpe ratio well above 0.5, and averaging would never show it. Remember to rebalance the weights on the same schedule you actually use, because a portfolio rebalanced quarterly and one left to drift produce different return series and different answers.
Five mistakes that inflate a Sharpe ratio in Excel
| Mistake | Effect on the ratio | Fix |
|---|---|---|
| Annual risk-free rate against monthly returns | Sharpe collapses or goes negative | Divide the rate by 12 |
| Annualizing an already annual figure | Inflated by roughly 3.5x | Annualize once, at the end |
| Using 365 instead of 252 for daily data | Understated by about 24% | Use 252 trading days |
| Prices in the column instead of returns | Nonsense output, often enormous | Convert to returns with =B3/B2-1 |
| Returns before trading costs | Overstated, badly for active rules | Subtract costs per trade first |
The last one is the most expensive. A rule trading twice a month at 0.1% per trade gives up about 2.4% a year, which on the worked example above would drag the Sharpe ratio from 0.61 down to roughly 0.42. Spreadsheets built from a broker's reported returns already include costs. Spreadsheets built from raw price data do not, and the difference decides whether a strategy looks viable.
Getting the return history into the spreadsheet
The formula is the easy half. Assembling a clean return series is the half that eats an afternoon. Prices need to be adjusted for splits and dividends, because raw closes invent a large negative return on every split date and silently omit every dividend, which corrupts both the numerator and the denominator. Most free price exports offer an adjusted close column, and it is the one you want.
If your actual account history only exists as a stack of monthly broker PDFs, extract it before you start rather than retyping figures. Statements converted into a spreadsheet preserve the exact dated balances, and a Sharpe ratio computed from balances you keyed in by hand carries whatever typos came with it.
When a spreadsheet is the wrong tool
Excel is the right answer when you already hold the return series and want a number in two minutes. It is the wrong answer when the return series does not exist yet, which is the case for any rule you have not traded. Building 20 years of daily adjusted prices, applying entry and exit conditions row by row, charging costs on each fill, and deriving the return column is a genuinely fiddly modeling job, and every step is a chance to introduce lookahead bias by referencing a value the rule could not have known at the time.
That is the gap our Sharpe ratio calculator fills: you state the rule in a sentence, and the bench derives the return series from 20+ years of adjusted daily history, charges 0.1% per trade, and reports the annualized Sharpe ratio next to the Sharpe ratio of simply buying and holding the same instrument over identical dates. That comparison is the part a spreadsheet almost never includes and the part that decides whether the number is impressive.
Once you have the figure, interpreting it is a separate skill. Start with what is a good Sharpe ratio for the benchmark ranges, then what is a good Sortino ratio for the downside-only read and what is a good Calmar ratio for the drawdown-based one. The volatility term sitting in the denominator is unpacked on standard deviation of returns, and if you are computing the ratio to judge a strategy you intend to trade, is backtesting accurate covers why an impressive historical Sharpe ratio so often fails to survive contact with the future.
How many observations do you need before the number means anything?
Sixty monthly observations, or five years, is the usual floor for a quotable Sharpe ratio, and more is better. The reason is that the ratio is an estimate with its own error bars, and those bars are wide on short samples. Two strategies posting 0.8 and 1.2 over three years are frequently indistinguishable once you account for estimation error.
There is a harder version of this problem when the ratio comes from searching rather than from a single test. Bailey, Borwein, Lopez de Prado and Zhu showed in the Notices of the American Mathematical Society (May 2014) that with only five years of daily data, trying more than 45 independent strategy configurations is close to guaranteed to produce an in-sample Sharpe ratio of 1.0 whose expected out-of-sample Sharpe ratio is zero. If you built your spreadsheet by adjusting a threshold until the number looked good, the number is measuring your search, not your strategy. Write the rule down first, then compute the ratio once.
Put it on the bench
Ideas are cheap. Verdicts take a bench.
Agenttrading restates your idea as a testable rule, backtests it on 20+ years of adjusted daily data, and explains the risks in plain English. Honest verdicts, even when the idea loses.
Past performance does not guarantee future results. For educational and informational purposes only. Not financial advice. Consult a licensed advisor.