Count the Number of Positive Return Periods
The PositivePeriods function in MarketXLS helps you find how many months (or other time periods) your portfolio achieved a positive return. By supplying a weighted portfolio and specifying the number of months to evaluate, you can gain insight into how consistently your holdings have performed over a given timeframe. This function is particularly useful for quick checks of performance stability and guiding investment decisions.
Why Use This Function?
- Quickly see how many months your portfolio experienced positive returns.
- Ideal for measuring consistency of performance over defined time periods (e.g., 12 months, 24 months, etc.).
- Helps identify trends or patterns in your portfolio’s performance.
- Useful for spotting extended positive runs and evaluating if the portfolio’s strategy aligns with your goals.
- Great for combining with other MarketXLS analytics to deepen your performance insights.
How to Use in Excel
=PositivePeriods(portfolio, [period])
Where “portfolio” is typically a range of cells in Excel containing your tickers and their weights, and “period” is an optional integer specifying how many months you’d like to evaluate. If “period” is omitted (or left blank), it defaults to 12 months.
- In an Excel worksheet, list your portfolio’s tickers in one column and their weights in the adjacent column (e.g., A1:B5).
- Select a cell where you want the result and enter the function.
- For the portfolio argument, reference your portfolio's cell range.
- For the period argument, supply an integer for the number of months to evaluate (optional).
- Press Enter to view how many of those months had a positive return.
Parameters Explained
Parameter | Description | Example Values | Notes |
---|---|---|---|
portfolio | A range or array that defines your tickers and their respective weights in the portfolio. | A1:B5, or {"AAPL",0.5;"MSFT",0.5} | Must be a valid portfolio with tickers and weights. The function auto-adjusts weights if they do not sum to 1. |
period | (Optional) The number of months used to check for positive returns. Defaults to 12 if not provided. | 6, 12, 24, 36 | The function attempts to retrieve historical data for your chosen period. Large periods may require more historical data. |
Example Usage
Basic Examples
-
Default 12-Month Check
Suppose cells A1:A2 contain “AAPL” and “MSFT”, and cells B1:B2 contain 0.5 for each (both tickers weighted equally).
• In cell C1, enter:
=PositivePeriods(A1:B2)
• This checks how many of the last 12 months have produced a positive return for your AAPL/MSFT portfolio. The result might be 8, meaning 8 out of 12 months were in positive territory. -
24-Month Check
• In cell C2, enter:
=PositivePeriods(A1:B2, 24)
• This calculates how many times in the last 24 months your combined AAPL/MSFT portfolio posted a positive monthly gain.
Advanced Scenarios
-
Multiple Tickers and Custom Period
- You can place 5 or 10 tickers in your sheet, each with a specific weight. For instance:
AAPL (0.30), MSFT (0.25), TSLA (0.20), VOO (0.25). - Use =PositivePeriods(A1:B4, 36) to see how many of the past 36 months ended up positive for this multi-ticker portfolio.
- You can place 5 or 10 tickers in your sheet, each with a specific weight. For instance:
-
Handling Portfolios with Missing Data
- If one or more tickers have incomplete price data (e.g., newly listed tickers), MarketXLS will ignore them and automatically adjust the remaining weights. The resulting “Positive Periods” count will focus on the data that is available.
-
Integrating with Other MarketXLS Functions
- Combine the count of positive months with Sharpe or Sortino Ratios (e.g., Sharpe(…)) to form a broader performance assessment. This reveals not only how consistently you gain but also the risk-adjusted nature of that gain.
Common Questions and Troubleshooting
• What if part of my portfolio has no historical data?
- Any tickers lacking enough data are excluded. The function automatically rebalances the remaining weights so you still receive a valid result.
• Why might I receive “NA” or an error?
- Common causes include invalid ticker symbols, referencing more than 500 tickers, or if you lack a valid MarketXLS license.
• What if my portfolio weights do not sum to 1?
- The function normalizes (adjusts) them so the total becomes 1 before calculating.
• Can I use daily or weekly data instead of monthly?
- PositivePeriods is specifically designed for monthly checks in the core implementation. If you need other periods, consider other MarketXLS functions.
• Is there a maximum period I can check?
- You can pass a higher period (e.g., 60 months). However, if the system cannot find enough data, some tickers may be excluded.
By leveraging PositivePeriods in Excel with MarketXLS, you can deepen your understanding of how often your holdings produce positive monthly returns. When consistently tracked and combined with other performance metrics, this function becomes a powerful tool in your investment analysis arsenal.