Screen stocks by sector and financial metrics
Use the Stock Screener to filter companies within a specific sector and rank them by financial metrics such as Operating Profit Margin TTM, Return on Equity, or Debt to Equity.
Plan requirement: Sector filtering is a basic filter available on all plans from Investor up. Advanced financial metrics like Operating Profit Margin TTM require the Analyst plan or a commercial plan.
Screen a sector by operating profit margin
Build a screen that returns Technology companies with an Operating Profit Margin TTM above 15%, ordered by margin from highest to lowest.
Open the Stock Screener from the Google Sheets dropdown, below the Function Generator. For the full UI walkthrough, see the Stock Screener guide.
Add a sector filter and set it to
Technology.Add an Operating Profit Margin TTM filter and set the operator to
>and the value to0.15.In the metrics section, select
symbol,sector,operatingProfitMarginTTM, andmarketCapso they appear in the output.Set the order to
ob=operatingProfitMarginTTMso the highest margins appear first.Click Generate to insert the formula into the active cell.
The resulting formula looks like this:
=SF_SCREEN("sector=Technology&operatingProfitMarginTTM>0.15", "symbol§or&operatingProfitMarginTTM&marketCap", "ob=operatingProfitMarginTTM")Swap the metric or sector
The same pattern works with any sector and any advanced filter. Replace the sector value with Healthcare, Energy, or another sector, and replace the margin filter with another financial metric.
Return on Equity TTM:
returnOnEquityTTM>0.20Debt to Equity TTM:
debtToEquityRatioTTM<0.50Price to Earnings TTM:
priceToEarningsRatioTTM<15Free Cash Flow Yield TTM:
freeCashFlowYieldTTM>0.05
Chain multiple conditions with &. For example, screen the Energy sector for companies with an Operating Profit Margin TTM above 10% and a Debt to Equity Ratio TTM below 1:
=SF_SCREEN("sector=Energy&operatingProfitMarginTTM>0.10&debtToEquityRatioTTM<1", "symbol§or&operatingProfitMarginTTM&debtToEquityRatioTTM&marketCap", "ob=operatingProfitMarginTTM")Limit and format the output
Use options to keep the result manageable:
limit=50returns only the first 50 rows.NHremoves the header rows so you can feed the result directly into a chart or pivot table.ob=-marketCaporders by market cap ascending instead of descending.
Options are chained with &:
=SF_SCREEN("sector=Technology&operatingProfitMarginTTM>0.15", "symbol§or&operatingProfitMarginTTM&marketCap", "ob=operatingProfitMarginTTM&limit=50&NH")Looking for a sector average instead?
The Stock Screener returns individual companies, not aggregated sector averages. If you need the average valuation or margin for an entire sector, use Sector PE or Industry PE instead.
For the complete list of available filters, metrics, and options, see the Stock Screener function reference.