create me a excel code that provides me the PEG ratio, earnings yield, 12-month price momentum, free cash flow yield, return on equity, and dividend yield in their own column for any stock symbol in a column next to it
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Certainly! You can use Excel formulas combined with the Stock Data Type and WEBSERVICE/JSON functions (or Power Query) to pull some of these metrics, but not all are natively available in Excel. However, with Microsoft 365 (or Excel 2021+), you can use the Stocks Data Type to get some of these fields directly.
Below is a step-by-step guide for each metric, assuming you have a list of stock symbols in column A (starting from A2):
1. Convert Symbols to Stock Data Type
Enter your stock symbols in column A (A2, A3, etc.).
Select the cells, go to the Data tab, and click Stocks. The cells will convert to the Stocks data type.
2. Insert Formulas for Each Metric
B: PEG Ratio
excel
=FIELDVALUE(A2, "PEG Ratio")
C: Earnings Yield
Earnings Yield = Earnings Per Share / Price
But Excel does not provide this directly. You can calculate it as:
excel
=FIELDVALUE(A2, "Earnings per share") / FIELDVALUE(A2, "Price")
Or, as a percentage:
excel
=FIELDVALUE(A2, "Earnings per share") / FIELDVALUE(A2, "Price") * 100
D: 12-Month Price Momentum
This is not directly available, but you can estimate it as: