To create an Excel spreadsheet that pulls financial data like the PEG ratio, Earnings Yield, 12-month Price Momentum, Free Cash Flow Yield, Return on Equity (ROE), and Dividend Yield for a stock symbol, you can use Excel's built-in functions such as STOCKHISTORY, FILTER, and INDEX along with Power Query or Power Pivot if you're using Excel 365 or 2021. However, many of these metrics are not directly available through the STOCKHISTORY function.
To pull real-time financial metrics, you'll need to use third-party add-ins like Bloomberg, Reuters, Morningstar, or Yahoo Finance via Power Query. Alternatively, you can use Excel + VBA with a web scraping API, or external APIs like Alpha Vantage, Yahoo Finance API, or IEX Cloud.
✅ Option 1: Using Excel Formulas (with Yahoo Finance via Power Query) – Recommended
Step-by-step:
- Enter your stock symbols in column A (e.g., A2:A100).
- Go to the Data tab > Get Data > From Other Sources > From Web.
- Enter the URL:
https://finance.yahoo.com/quote/AAPL/key-statistics?p=AAPL
(Replace AAPL with any symbol dynamically via Power Query later.)
- Import the table and clean the data to extract the following metrics:
- PEG Ratio
- Earnings Yield = 1 / P/E Ratio
- Free Cash Flow Yield = Free Cash Flow / Market Cap
- ROE = Net Income / Shareholder Equity
- Dividend Yield
- Create a parameter for the stock symbol and parameterize the URL so it loops through all symbols in your list.
This is the best way to pull live financial metrics into Excel.
✅ Option 2: Use Yahoo Finance API via Excel Power Query (Free)
Steps:
- Go to Data > Get Data > From Other Sources > From Web.
- Paste the following URL:
https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL
- Replace
AAPL with a parameter for dynamic symbol input.
- Parse the JSON response to extract:
pegRatio
forwardPE
profitMargin
dividendYield
returnOnAssets
freeCashflow
marketCap
You can calculate:
- Earnings Yield = 1 /
forwardPE
- PEG Ratio =
pegRatio
- Free Cash Flow Yield =
freeCashflow / marketCap
- ROE =
returnOnEquity
- Dividend Yield =
dividendYield
✅ Option 3: Use Excel VBA + Web Scraping (Advanced)
If you're comfortable with VBA, you can write a macro to fetch data from Yahoo Finance or another site. Here's a simplified example using XMLHTTP requests to scrape data:
Example VBA Code (for PEG Ratio):
Function GetYahooData(symbol As String, metric As String) As Variant
Dim http As Object
Dim url As String
Dim html As String
Dim result As String
Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
url = "https://finance.yahoo.com/quote/" & symbol & "/key-statistics?p=" & symbol
http.Open "GET", url, False
http.Send
html = http.ResponseText
' Use InStr and Mid to extract the metric from the HTML
If metric = "PEG" Then
startPos = InStr(html, "PEG Ratio")
startPos = InStr(startPos, html, "<td")
startPos = InStr(startPos, html, ">") + 1
endPos = InStr(startPos, html, "<")
result = Mid(html, startPos, endPos - startPos)
End If
GetYahooData = result
End Function
Then in Excel:
=GetYahooData(A2, "PEG")
⚠️ Note: This approach is fragile and breaks easily if Yahoo changes its HTML structure.
✅ Option 4: Use Third-Party Excel Add-ins
Some add-ins like:
- MarketXLS
- Bloomberg Excel Add-in
- Reuters Eikon
- Alpha Vantage Excel Plug-in
allow you to retrieve financial metrics directly with formulas like:
=ALPHA_VANTAGE("PEG_RATIO", "AAPL")
=ALPHA_VANTAGE("EARNINGS_YIELD", "AAPL")
=ALPHA_VANTAGE("FCF_YIELD", "AAPL")
=ALPHA_VANTAGE("ROE", "AAPL")
=ALPHA_VANTAGE("DIVIDEND_YIELD", "AAPL")
=ALPHA_VANTAGE("12MOMENTUM", "AAPL")
These are easy to use but often require a paid subscription.
✅ Sample Output Table in Excel
| Stock | PEG Ratio | Earnings Yield | 12M Price Momentum | FCF Yield | ROE | Dividend Yield |
|---|
| AAPL | 2.3 | 0.045 | 0.25 | 0.06 | 0.15 | 0.006 |
| MSFT | 1.8 | 0.05 | 0.3 | 0.07 | 0.35 | 0.01 |
📌 Summary
| Feature | Method |
|---|
| Best Free Method | Power Query + Yahoo Finance |
| Easiest Paid Method | MarketXLS or Alpha Vantage |
| Most Flexible | VBA + API |
| Most Accurate | Bloomberg / Eikon / Reuters |
Would you like me to provide a ready-to-use Excel template or help you build this in Power Query?