Close Price-Earnings Ratio (Historical) Formula in Excel
The Close Price-Earnings Ratio (Historical) formula in Excel with MarketXLS helps you quickly obtain a company’s historical P/E ratio, a key metric used by investors to gauge how the market values a stock relative to its past or future earnings. This function is especially helpful when performing fundamental analysis directly in Excel to make informed trading and investment decisions.
Understanding Close Price-Earnings Ratio (Historical)
-
Purpose and Use Cases
The Close Price-Earnings Ratio (Historical) function fetches the company’s historical P/E ratio, allowing you to analyze valuation trends over specific years or quarters. -
Key Benefits
- Quick retrieval of historical P/E data for fundamental analysis.
- Allows easy comparison against other fundamental metrics in Excel.
- Simplifies advanced research and valuation modeling.
-
When to Use
Use this function anytime you want to examine how a stock’s P/E has changed over time, compare valuations across multiple periods, or conduct trend analysis on historical fundamentals.
Syntax and Parameters
=hf_Close_Price_Earnings_Ratio(Symbol, Year, [Quarter], [TTM])
Parameter | Description | Required | Example |
---|---|---|---|
Symbol |
The stock symbol (e.g., "MSFT", "^SPX" for indices, "@MSFT 110122C00020000" for options, or "BTCUSD:DEFAULT" for crypto). | Yes | "MSFT" |
Year |
The year or a shortcut for last quarter/year (e.g., "2022", "lq" for last quarter, "ly" for last year, "lt" for last 12 months). | Yes | 2022 |
Quarter |
The calendar quarter to fetch data for (1, 2, 3, 4). Leave blank for default or special strings like “lq-1”. | No | 2 |
TTM |
Set to "TTM" if you want trailing 12 months data. Leave blank if not needed. | No | "TTM" |
Return Value
• Returns a numeric value representing the company’s P/E ratio for the specified historical period.
• Returns "NA" if the symbol is invalid, the license is not valid, or data cannot be retrieved.
?? Note: Always ensure your MarketXLS license subscription includes historical fundamentals data; otherwise, the function will return "NA".
Examples and Usage
Below are practical usage examples. Mix and match parameters to suit your analysis.
Basic Examples
=hf_Close_Price_Earnings_Ratio("MSFT", 2022)
Retrieves the P/E ratio for Microsoft for the year 2022.
=hf_Close_Price_Earnings_Ratio("MSFT", 2022, 2)
Retrieves the P/E ratio for Microsoft for the year 2022, quarter 2.
Advanced Scenarios
=hf_Close_Price_Earnings_Ratio("MSFT", 2022, 3, "TTM")
Retrieves trailing twelve months P/E ratio for Microsoft using 2022, quarter 3 as a reference point.
=hf_Close_Price_Earnings_Ratio("MSFT", "lq")
Fetches the P/E ratio for Microsoft for the last reported quarter.
=hf_Close_Price_Earnings_Ratio("MSFT", "ly-1")
Fetches the P/E ratio for Microsoft for the previous last year (one year back from the last reported year).
? Pro Tip: Use shortcuts like "lq-1" or "ly-1" to access older data quickly without specifying exact years.
Using Different Symbol Types
=hf_Close_Price_Earnings_Ratio("^SPX", 2022)
=hf_Close_Price_Earnings_Ratio("@MSFT 110122C00020000", "lq")
=hf_Close_Price_Earnings_Ratio("BTCUSD:DEFAULT", "ly")
Works similarly for indices, options, or crypto symbols.
Accepting Date Inputs
While this function typically expects a year (or a shortcut), you can reference cells or date functions:
=hf_Close_Price_Earnings_Ratio("MSFT", A1)
=hf_Close_Price_Earnings_Ratio("MSFT", "2024-03-15")
=hf_Close_Price_Earnings_Ratio("MSFT", TEXT(A1,"yyyy-mm-dd"))
When passing a full date, only the year portion may be used in the calculation if supported by MarketXLS.
Common Questions
-
What if the function returns "NA"?
- Check if you have an active MarketXLS subscription that supports historical fundamentals.
- Verify the symbol's correctness and your internet connection.
-
Can I use this for non-stock symbols?
- Yes! You can use indices (e.g., "^SPX"), options, and crypto symbols, as long as MarketXLS supports these.
-
What are possible performance considerations?
- Repeated calls for many symbols at once can slow down Excel, depending on data retrieval times. Consider batching or limiting simultaneous updates.
-
Why do I see different numbers for the same year?
- The function may adjust results for restatements or TTM calculations. Always confirm the exact parameters (quarter and TTM) to ensure consistency.
-
Related Functions
- Revenue (Historical)
- Cost Of Revenue (Historical)
- Gross Profit (Historical)
- R & D Expenses (Historical)
- Selling General and Administrative Expense (Historical)
?? Note: Data availability can vary based on the symbol or the region. Always double-check if the coverage includes the period you are interested in.