Custom Ratio Calculations

Compare a stock to sector and industry PE

SheetsFinance provides pre-built sector and industry PE averages by exchange. When you pass a specific exchange, sector or industry name, and date, the function returns a single value that you can compare directly to a stock PE.

How sector and industry PE work

Both functions return the average market PE for the specified sector or industry on the specified exchange and date.

  • sectorPE — average PE by sector for an exchange. Chain multiple sectors with &.

  • industryPE — average PE by industry for an exchange. Chain multiple industries with |.

When you fully specify one sector or industry and one date, the function returns a single cell. When you pass "all" or leave the filter blank, it returns a table with all sectors or industries.

Get the sector PE for an exchange

Pass the exchange symbol and a specific sector name. The first argument is the exchange, not a stock ticker.

Put the current date (TODAY()) in a cell, for example $A$1, and reference it from the formula. This keeps the sheet fast because Google Sheets recalculates TODAY() every time anything changes.

=SF("NASDAQ", "sectorPE", "Technology", $A$1)

Performance tip: Put =TODAY() in one cell and reference that cell everywhere you need the current date. Google Sheets recalculates TODAY() on every sheet change, so calling it in many formulas slows the sheet down. For more details, see Performance Tips.

This returns a single value: the average PE for the Technology sector on the NASDAQ today.

Get the industry PE for an exchange

Pass the exchange symbol and a specific industry name. Use | to chain multiple industries.

=SF("NASDAQ", "industryPE", "Software - Application", $A$1)

This returns a single value: the average PE for that industry on the NASDAQ today.

Compare a stock PE to the sector average

Divide the stock's real-time PE by the sector PE in one cell. Because both are single values, no wrapper is needed.

=SF("AAPL", "realTime", "pe") / SF("NASDAQ", "sectorPE", "Technology", $A$1)

A value above 1 means the stock is more expensive than its sector average; below 1 means it is cheaper.

Compare a stock PE to the industry average

=SF("AAPL", "realTime", "pe") / SF("NASDAQ", "industryPE", "Software - Application", $A$1)

Look up a stock's sector or industry name

Use the company info dataset to find the exact sector or industry name for a ticker.

=SF("AAPL", "companyInfo", "sector")
=SF("AAPL", "companyInfo", "industry")

The name must match exactly what is stored in the dataset, including spacing and punctuation.

Historical comparison

Pass a specific date instead of the cell reference to compare against a historical sector or industry average.

=SF("AAPL", "realTime", "pe") / SF("NASDAQ", "sectorPE", "Technology", "2024-01-01")

Dates can be a Google Sheets date object, YYYY-MM-DD, or DD/MM/YYYY.

Filter by expensive industries

Use "all" to return a full table of industries and their PE values, then filter the result.

=SF("NASDAQ", "industryPE", "all", $A$1)

This returns an array because you asked for all industries. You can then use INDEX or ARRAY_CONSTRAIN to extract specific rows.

Formatting options

Add "NH" to remove headers, or "-" to reverse the order. Combine both as "NH&-".

=SF("NASDAQ", "industryPE", "all", $A$1, "NH")

What is next

For the full reference on sector PE, read Sector PE. For the full reference on industry PE, read Industry PE. For single-cell extraction from arrays, see Get a single value from a multi-row function.

Was this helpful?