From a list of stocks to a set of scores
Open any fund factsheet that calls itself "smart beta", "multi-factor" or "quality tilt" and you will find words like value, momentum and quality. Behind each of those words sits a very concrete calculation: a ratio for every stock, a ranking, and a rule that turns the ranking into a portfolio. This free first lesson of Factor Investing: Value, Momentum, Quality & Smart Beta shows you those calculations from the ground up, in Excel, on a universe of 20 stocks.
It is written for finance students who meet factor models in lectures and want to see the numbers, for analysts who have to explain what a factor fund actually holds, and for curious investors who prefer to understand a method before reading marketing material about it. You need basic Excel: entering a formula, copying it down and using a dollar sign to lock a reference. Everything else is explained here.
The universe in the lab is synthetic: Stock 01 to Stock 20 are invented, with invented prices, book values, profits and equity. That is deliberate. It lets you focus on the method without any temptation to read the result as a stock tip. The course is educational only and is not investment advice. It does not recommend buying or selling anything, and nothing in it suggests that a factor will earn a premium in the future.
What a factor is, in plain words
A factor is a characteristic shared by many stocks that helps describe why groups of stocks behaved differently from each other in the past. Researchers found that sorting stocks by certain characteristics produced groups with different average returns in historical data, and those characteristics became known as factors. Whether such differences persist, and why, is debated: some explanations point to risk, others to investor behaviour, and in many periods a factor simply did not work. For this lesson, the important point is practical: a factor is something you can measure for every stock with a formula.
Value asks how expensive a stock is relative to some fundamental quantity. The classic measure is price-to-book (P/B): the share price divided by the book value per share, which is the accounting equity per share from the balance sheet. A P/B of 1.07 means you pay 1.07 for each unit of equity on the books, a P/B of 5.33 means you pay 5.33. Lower is "cheaper" in the value sense, so the stock with the lowest P/B gets value rank 1.
Momentum asks how strongly a stock has been trending. The standard measure is 12-1 momentum: the return from the price twelve months ago to the price one month ago. The most recent month is skipped deliberately. Over horizons of a few weeks, stock returns tend to reverse slightly, and including that month would mix a short-term reversal effect into a measure meant to capture the longer trend.
Quality has many definitions in practice, from profit margins to low debt to stable earnings. The simplest, and the one the lab uses, is return on equity (ROE): net income divided by shareholders' equity. It answers the question "how much profit does the company generate on the capital that belongs to its owners?". Higher is better.
Worked example: scoring the 20-stock universe
The lab gives you seven raw columns: price (B), book value per share (C), the price twelve months ago (D), the price one month ago (E), net income in millions (F) and equity in millions (G). From those you calculate four new columns. The formulas are short:
| Column | Measure | Formula in row 2 | Copy to | Better when |
|---|---|---|---|---|
| H | Price-to-book | =B2/C2 | H21 | lower (cheaper) |
| I | Momentum 12-1 | =E2/D2-1 | I21 | higher (stronger trend) |
| J | Return on equity | =F2/G2 | J21 | higher (more profitable) |
| K | Value rank | =RANK.EQ(H2,$H$2:$H$21,1) | K21 | 1 = cheapest |
Here is the complete result for all 20 stocks. You can use it to check your own work in the lab, cell by cell.
| Stock | Price | Book / share | P/B (H) | Mom 12-1 (I) | ROE (J) | Value rank (K) |
|---|---|---|---|---|---|---|
| Stock 01 | 48.37 | 17.24 | 2.81 | 36.7 % | 7.9 % | 12 |
| Stock 02 | 145.64 | 102.09 | 1.43 | 26.3 % | 24.4 % | 4 |
| Stock 03 | 94.68 | 18.79 | 5.04 | 14.0 % | 2.7 % | 19 |
| Stock 04 | 118.43 | 49.04 | 2.41 | -12.4 % | 23.8 % | 9 |
| Stock 05 | 120.96 | 58.84 | 2.06 | 27.5 % | 21.0 % | 7 |
| Stock 06 | 148.71 | 36.24 | 4.10 | 45.1 % | 26.4 % | 17 |
| Stock 07 | 22.60 | 4.24 | 5.33 | 17.1 % | 2.3 % | 20 |
| Stock 08 | 99.77 | 62.49 | 1.60 | -12.2 % | 6.9 % | 5 |
| Stock 09 | 49.37 | 45.97 | 1.07 | 3.3 % | 4.2 % | 1 |
| Stock 10 | 60.28 | 16.81 | 3.59 | 6.1 % | 14.2 % | 15 |
| Stock 11 | 86.44 | 32.44 | 2.66 | 13.7 % | 14.7 % | 11 |
| Stock 12 | 66.08 | 15.56 | 4.25 | 41.6 % | 4.3 % | 18 |
| Stock 13 | 171.92 | 151.08 | 1.14 | 25.0 % | 6.3 % | 3 |
| Stock 14 | 89.63 | 41.96 | 2.14 | -14.6 % | 18.5 % | 8 |
| Stock 15 | 18.87 | 5.71 | 3.30 | 2.5 % | 32.3 % | 14 |
| Stock 16 | 92.24 | 34.94 | 2.64 | 12.6 % | 15.4 % | 10 |
| Stock 17 | 111.39 | 103.07 | 1.08 | 29.9 % | 28.6 % | 2 |
| Stock 18 | 29.63 | 15.36 | 1.93 | 31.0 % | 22.4 % | 6 |
| Stock 19 | 71.20 | 23.96 | 2.97 | -18.6 % | 18.3 % | 13 |
| Stock 20 | 55.82 | 15.23 | 3.67 | -18.7 % | 16.6 % | 16 |
A few observations are worth making, because reading a score table is a skill in itself. The cheapest stock on book value is Stock 09 with a P/B of 1.07, followed very closely by Stock 17 at 1.08 and Stock 13 at 1.14. At the other end, Stock 07 (5.33) and Stock 03 (5.04) are the most expensive. Note that the cheapest stocks are not necessarily the "best" ones. Stock 09 has an ROE of only 4.2 %: a low price relative to book value can simply reflect low profitability. This is exactly why practitioners combine value with quality.
On momentum, Stock 06 leads with 45.1 % and Stock 12 follows with 41.6 %. 5 stocks have negative momentum, the weakest being Stock 20 at -18.7 % and Stock 19 at -18.6 %. On quality, Stock 15 has the highest ROE at 32.3 %, and Stock 07 the lowest at 2.3 %.
One stock stands out on all three measures at once: Stock 17 combines the second-lowest P/B (1.08), strong momentum (29.9 %) and the second-highest ROE (28.6 %). In real data such clean all-rounders are rare, because the factors often pull in different directions: stocks that have risen strongly tend to have become more expensive, so momentum and value are frequently in tension. Lesson 2 of the course shows how to combine factors into one composite score precisely because no single stock wins everywhere.
How to build the factor scores in Excel, step by step
- Open the lab above, or put your own data in a sheet with one stock per row and the raw inputs in columns B to G. Keep headers in row 1 and avoid blank rows inside the data, so that copying formulas and sorting work cleanly.
- In H2, type
=B2/C2for price-to-book. Price on top, book value per share below. Book-to-price (=C2/B2) is a valid measure too, but then higher means cheaper, so keep track of which one you use. - In I2, type
=E2/D2-1for 12-1 momentum: the price one month ago divided by the price twelve months ago, minus 1. Format the column as a percentage with Ctrl+Shift+% or Home > Number > Percent Style, and add one decimal. - In J2, type
=F2/G2for ROE. Both values are in millions, so the units cancel out. Format as a percentage. - In K2, type
=RANK.EQ(H2,$H$2:$H$21,1). While the cursor is inH2:H21, press F4 once to turn it into$H$2:$H$21, so the range stays fixed when you copy. The last argument 1 means ascending: the smallest P/B gets rank 1. You can also insert the function through Formulas > More Functions > Statistical > RANK.EQ. - Select H2:K2 and double-click the small square at the bottom right of the selection (the fill handle), or select H2:K21 and press Ctrl+D. All four formulas fill down to row 21.
- Check the ranking. Click any header and press Ctrl+Shift+L to turn on filters, then sort column K from smallest to largest (Data > Sort & Filter > Sort A to Z). The P/B values in column H must now increase from top to bottom. Undo the sort with Ctrl+Z if you want the original order back.
- Optional: add momentum and quality ranks next to the value rank, with
=RANK.EQ(I2,$I$2:$I$21,0)and=RANK.EQ(J2,$J$2:$J$21,0). Here the order is 0, descending, because a higher momentum and a higher ROE are better. - Optional: chart the result. Select the stock names and the P/B column and use Insert > Charts > Bar. Sort first, and the chart becomes the sorted value ranking shown above.
=PERCENTRANK.INC($H$2:$H$21,H2). It returns 0 for the cheapest and 1 for the most expensive stock, so a universe of 20 and one of 2,000 stocks become comparable.
Common mistakes and how to spot them
- Ranking in the wrong direction.
=RANK.EQ(H2,$H$2:$H$21)without the third argument ranks descending, so the most expensive stock becomes rank 1. Spot it by checking that rank 1 sits next to the smallest P/B. - Forgetting the dollar signs. If the range is not locked, it slides down as you copy (
H3:H22,H4:H23…) and lower rows are ranked against an incomplete list. Duplicate ranks or ranks that never reach 20 are the warning sign. - Using the full-year return as momentum.
=B2/D2-1runs to today's price. It is a valid return, but it is not 12-1 momentum, and for stocks that moved sharply last month it gives a noticeably different number. - Flipping the ratio.
=C2/B2is book-to-price and=G2/F2is equity over income. Both look plausible. A quick sense check: P/B values around 1 to 5 and ROE values of a few percent to a few tens of percent are typical in this lab. - Ignoring negative or tiny book values. In real data some companies have negative equity. Their P/B becomes negative and would rank as the "cheapest" stock. Practitioners exclude them or use book-to-price, which handles this case more gracefully. The same applies to ROE when equity is negative.
- Comparing across very different industries. Banks, software companies and utilities have structurally different book values. Many factor methods rank within each sector first. The lab keeps one universe to teach the mechanics.
- Treating a score as a forecast. A rank describes where a stock stands today on a measure. It says nothing certain about what the stock will do next. The later lessons test that question properly with portfolios and statistics.
Why the lesson stops at ranking
It is tempting to jump straight from a ranking to a portfolio: take the five cheapest stocks and call it a value strategy. Professional factor methods do not work that way, and this course does not either. A ranking on one measure is only the raw material. Before it can say anything useful, three more questions need answers. First, how do you combine measures that live on completely different scales, such as a ratio around 1 to 5, a return between minus 19 % and plus 45 % and a profitability percentage? Second, does sorting by the score actually separate stocks into groups that behaved differently, or is the pattern indistinguishable from chance? Third, what is left after trading costs and turnover?
Each of those questions has its own lab later in the course, with its own Excel tools: z-scores for combining, quintile portfolios and t-statistics for testing, turnover for costs. Keeping the first lesson to clean measurement is deliberate. Most errors in real factor research do not come from advanced statistics but from the first step: a ratio flipped by accident, a range that was not locked, a stale price or a negative book value that slipped into the ranking. If the scores are right, everything that follows can be checked. If they are wrong, no regression will rescue the result.
Quick reference: functions and shortcuts used
| Function or shortcut | What it does | Example |
|---|---|---|
RANK.EQ(number, ref, [order]) | Rank within a list; order 1 = ascending, 0 or omitted = descending | =RANK.EQ(H2,$H$2:$H$21,1) |
PERCENTRANK.INC(array, x) | Position as a share from 0 to 1, independent of list size | =PERCENTRANK.INC($H$2:$H$21,H2) |
SMALL(array, k) / LARGE(array, k) | The k-th lowest / highest value | =SMALL($H$2:$H$21,1) |
XLOOKUP(lookup, lookup_array, return_array) | Finds the stock that belongs to a value or rank | =XLOOKUP(1,$K$2:$K$21,$A$2:$A$21) |
IFERROR(value, value_if_error) | Catches division by zero for missing data | =IFERROR(B2/C2,"") |
| F4 | Cycles a reference through $H$2, H$2, $H2, H2 | Lock the ranking range |
| Ctrl+D or double-click the fill handle | Copies a formula down to the end of the data | Fill H2:K2 down to row 21 |
| Ctrl+Shift+L | Turns on filter buttons for sorting | Sort by column K to check the ranking |
| Ctrl+Shift+% | Percent format for momentum and ROE | Format I2:J21 |
Real-world uses of factor scores
- Understanding what a factor ETF holds. A value or quality fund publishes its index methodology. With the calculations from this lesson you can read that methodology and reproduce the core screen on a sample of stocks.
- Portfolio analysis. Analysts score an existing portfolio on value, momentum and quality to describe its tilts: is it cheaper or more expensive than its benchmark, more or less profitable?
- Screening for research. An equity analyst can use a factor screen to decide which companies to study in more depth, as one input among many rather than as a decision rule.
- Teaching and exams. CFA-style and university finance courses use exactly these ratios. Building them once in a spreadsheet makes the definitions stick.
- Risk reporting. Factor exposures help explain why a portfolio behaved as it did in a given month, which is a regular question in investment committees.
What you will build in the rest of this course
This first lesson is free. The 19 remaining labs are part of the full course for a one-time price of $9.90. Each one takes the scores you just built one step further, from ranking to portfolios to statistical tests, always on synthetic data and with every formula checked.
Z-Scores & a Weighted Multi-Factor Composite. P/B, momentum and ROE live on different scales, so you cannot add them. You standardise each one with AVERAGE and STDEV.S, combine them 40/30/30 into a composite score with SUMPRODUCT and find the top-ranked stock with XLOOKUP.
Quintile Portfolios: Rank → Bucket → Average Return. You sort the universe into five portfolios of four stocks by composite score, calculate each quintile's next-month return with AVERAGEIF and chart the pattern, the basic test of whether a score separates stocks at all.
Long-Short Factor Return: Q1 minus Q5, Hit Rate & t-Stat. You build the monthly return of a portfolio that is long the top quintile and short the bottom one, compound it, count how often it was positive and calculate a t-statistic to judge whether the average is more than noise.
CAPM Beta & Alpha with SLOPE and INTERCEPT. You regress a value portfolio's excess returns on the market's and read off beta, alpha and R², the language every factor paper uses.
Multi-Factor Regression with LINEST (Fama-French Style). You regress a fund's returns on four factor returns at once and read its market beta, value tilt, alpha and R² from a single LINEST array.
Rebalancing Turnover & Trading-Cost Drag. You measure how much of a monthly-rebalanced factor portfolio is traded and how much of a backtested premium trading costs would consume, a step many backtests leave out.
Backtest Summary: CAGR, Volatility, Sharpe & Max Drawdown. You summarise a 36-month synthetic backtest with the four numbers every factsheet shows and chart the growth of $1 against a benchmark, so you can read such tables critically.
Summary
Factor investing starts with three simple measures. Value is price-to-book, =B2/C2, where lower is cheaper. Momentum 12-1 is =E2/D2-1, the return from twelve months ago to one month ago. Quality, in its simplest form, is return on equity, =F2/G2. A ranking with =RANK.EQ(H2,$H$2:$H$21,1) turns the value measure into an order from cheapest to most expensive. In the synthetic universe, Stock 09 is the cheapest stock, Stock 06 has the strongest momentum and Stock 15 the highest ROE, and only Stock 17 scores well on all three.
Scroll up to the lab and build the four columns yourself. It takes about fifteen minutes, the spreadsheet checks every result, and you will have the foundation that every later lesson, and every factor methodology you read, builds on.
Frequently asked questions
What is factor investing in simple terms?
Factor investing groups stocks by measurable characteristics such as valuation, recent price trend or profitability, and builds portfolios from those groups. Each characteristic is calculated with a formula for every stock and then ranked.
How do I calculate price-to-book in Excel?
Divide the share price by the book value per share, for example =B2/C2. If you only have total equity and the share count, calculate book value per share first as equity divided by shares outstanding.
What is 12-1 momentum and why skip the last month?
12-1 momentum is the return from the price twelve months ago to the price one month ago, =E2/D2-1 in the lab. The latest month is skipped because very short-term returns tend to reverse slightly, which would add noise to the trend measure.
How do I rank stocks from cheapest to most expensive in Excel?
Use =RANK.EQ(H2,$H$2:$H$21,1). The third argument 1 ranks in ascending order, so the lowest P/B gets rank 1, and the dollar signs keep the range fixed when you copy the formula down.
Is ROE a good measure of quality?
ROE is the simplest common quality measure, but it can be inflated by high debt or distorted by negative equity. Many methodologies combine it with other measures such as leverage or earnings stability.
Do factors always earn higher returns?
No. Factor returns vary a lot and some factors have gone through long periods of underperformance. This course teaches the calculations on synthetic data and does not imply that any factor will earn a premium in the future.
Keep going: Factor Investing: Value, Momentum, Quality & Smart Beta
This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time $9.90.
- Z-Scores & a Weighted Multi-Factor Composite
- Quintile Portfolios: Rank → Bucket → Average Return
- Long-Short Factor Return: Q1 minus Q5, Hit Rate & t-Stat
- CAPM Beta & Alpha with SLOPE and INTERCEPT
- Multi-Factor Regression with LINEST (Fama-French Style)
- Rebalancing Turnover & Trading-Cost Drag
- Backtest Summary: CAGR, Volatility, Sharpe & Max Drawdown
- Outliers & Sector Bets: Capped Z-Scores and Sector-Relative Value
- Information Coefficient: Rank IC, ICIR & Cumulative IC
- Factor Correlations: Why Value and Momentum Belong Together
- Low-Volatility Factor: Terciles, Beta & a Beta-Neutral Long-Short
- Smart-Beta Weights: Score Tilts, Active Share & Factor Exposure
- Fama-French Sorts I: Size & Value Breakpoints and the 2 × 3 Grid
- Fama-French Sorts II: Building SMB and HML from Six Portfolios
- Rolling 12-Month Factor Returns & a Momentum Crash
- Data Snooping: t-Stats, Multiple Testing & Out-of-Sample Decay
- Strategy Capacity: Square-Root Market Impact & Break-Even Fund Size
- Explaining a Fund's Year: Factor Contributions, Alpha & a Waterfall
- Capstone Project: Multi-Factor Fund Review Dashboard