Tabellab

You are not signed in — the lab works, but your progress is not saved. Sign up

Lesson 1 of 20 is free. Unlock all 20 hands-on labs, the final exam and your certificate.

Buy course — $9.90
Loading the spreadsheet…

Who are your best customers, really?

Every shop owner has a feeling about who the good customers are. The feeling is usually based on a few memorable names: the person who placed one huge order last spring, the regular who emails every month. Data tells a more honest story. Some customers who look important have quietly stopped buying, and some who never stand out buy small amounts again and again. RFM analysis is the classic, simple way to make that story visible, and it is still used by e-commerce teams, retailers, charities and subscription businesses because it needs nothing more than an order list.

This free lesson is for marketers, e-commerce managers, small-business owners, CRM and data analysts and students who have an export of orders and want to turn it into something they can act on. It is the first step of a full segmentation: before you can score, group or cluster customers, you need one clean row per customer with three numbers. That is exactly what you build here, with three Excel functions and one fixed date.

We follow Juniper & Oak, a fictional online homeware shop. Its shop system exported 24 orders from eight customers over roughly 17 months. The analysis date is 30 September 2026. The lab above contains the same order log, so every number in this article can be checked in the live spreadsheet. All names and amounts are invented for teaching.

The core idea: three numbers per customer

RFM stands for Recency, Frequency and Monetary. Each one answers a simple question about a customer:

  • Recency: how many days ago did they last buy? Lower is better. A customer who bought last week is far more likely to buy again than one who last bought a year ago.
  • Frequency: how many orders did they place in a recent window, usually the last 12 months? Higher is better. Repeat buying is a sign of a habit.
  • Monetary: how much did they spend in the same window? Higher is better. It tells you how much is at stake with each customer.

The challenge is the shape of the data. Your shop system, accounting tool or payment provider gives you one row per order: order number, customer, date, amount. RFM needs one row per customer. Turning the first into the second is a classic aggregation: for each customer, take the maximum date, count the rows and sum the amounts. In Excel those three steps are MAXIFS, COUNTIFS and SUMIFS.

Two design decisions make the result trustworthy. First, the analysis date is typed into a cell (here C2) instead of using TODAY(). With TODAY() every recency changes overnight, and a report you send on Monday no longer matches the file your colleague opens on Tuesday. Second, frequency and monetary use a window: only orders after the analysis date minus 365 days count. Without a window, a customer who was loyal two years ago and has since disappeared looks exactly as good as one who buys today.

Why these three and not, say, age or location? Because they describe behaviour, and past buying behaviour is one of the most reliable predictors of future buying behaviour that a shop has. They also come from data every business already has, they are easy to explain to a colleague in one sentence, and they do not need any personal details beyond a customer ID. Demographics can be added later as a second layer, but most teams find that the behavioural picture alone already changes how they spend their marketing budget.

Keep in mind that RFM describes customers, it does not judge them. A low score does not mean a bad customer. A new customer who bought once last week has excellent recency but low frequency simply because there has not been time for more orders. That is why the three numbers are always read together, and why later lessons combine them into segments instead of ranking customers on a single total.

Excel stores dates as serial numbers: 30 September 2026 is day 46,295 counted from the start of 1900. That is why =$C$2-B31 returns a number of days, and why $C$2-365 is a valid cut-off date. If a subtraction returns #VALUE!, one of the "dates" is text. Convert it with DATEVALUE or Data › Text to Columns.

Worked example: Juniper & Oak's eight customers

The order log sits in A4:D28 (order, customer, order date, amount). The RFM base table starts in row 30 with one row per customer. Here is the finished result, plus a last column with all orders ever placed, so you can see what the 12-month window changes. The window starts after 30 September 2025, so an order on 29 September 2025 is already outside it.

CustomerLast order (B)Recency, days (C)Orders 12 m (D)Revenue 12 m (E)All orders / all revenue
C-1012026-09-18125$1,025.806 / $1,235.80
C-1022026-02-112311$120.502 / $215.50
C-1032026-09-2554$284.504 / $284.50
C-1042025-09-023930$0.002 / $455.00
C-1052026-03-142001$54.002 / $101.00
C-1062026-06-101122$800.002 / $800.00
C-1072026-05-261273$239.304 / $315.80
C-1082026-09-12181$115.002 / $245.00
Total17$2,639.1024 / $3,652.60

Read the table row by row and the customers come to life. C-101 ordered 5 times in the last 12 months for $1,025.80, last time 12 days ago: that is 39% of all 12-month revenue from one person, the textbook "champion". C-106 placed only two orders, but both were large ($800.00 in total), and the last one was 112 days ago: valuable, but worth watching. C-107 buys small baskets often (3 orders, $239.30). C-104 spent $455.00 in the past, more than five of the other customers, yet has not ordered for 393 days. Inside the window their frequency and monetary values are zero. That is not an error; it is exactly the signal RFM is designed to send: a once-valuable customer is drifting away.

The four formulas in row 31, each copied down to row 38:

  • B31 =MAXIFS($C$5:$C$28,$B$5:$B$28,A31): the latest order date of the customer in A31. Format the cell as a date (Ctrl+1 › Date).
  • C31 =$C$2-B31: recency in days, the analysis date minus the last order.
  • D31 =COUNTIFS($B$5:$B$28,A31,$C$5:$C$28,">"&$C$2-365): orders in the 12-month window.
  • E31 =SUMIFS($D$5:$D$28,$B$5:$B$28,A31,$C$5:$C$28,">"&$C$2-365): revenue in the same window.

The criterion ">"&$C$2-365 is worth a closer look. COUNTIFS and SUMIFS take conditions as text, so you glue the comparison operator to a calculated date with &. Excel first calculates $C$2−365 (the serial number of 30 September 2025), then builds the condition ">45930" and applies it to the date column. Writing ">$C$2-365" inside the quotes would compare the dates with a piece of text and count nothing.

Monetary: last 12 months vs. all time ($)Last 12 months (M)All orders02004006008001,0001,2001,4001,0261,236C-101121216C-102285285C-1030455C-10454101C-105800800C-106239316C-107115245C-108Customer (analysis date 30 Sep 2026)
Monetary inside the 12-month window (blue) next to all-time revenue (peach). C-104 has the third-highest all-time revenue but zero in the window, which is exactly why RFM uses a window.

Step by step: build the RFM base table in Excel

The procedure below works for 24 orders or 240,000. With a larger log, convert the data into an Excel table first (Ctrl+T) so the ranges grow automatically.

  1. Put the analysis date in a cell of its own (C2) and label it. Use the last day of the period you analyse, for example the end of the last full month, not TODAY().
  2. Check that the order dates are real dates: select the column and look at the status bar. If Excel shows a Sum or Average, they are numbers; if it only shows a Count, they are text and need Data › Text to Columns › Finish or =DATEVALUE().
  3. Make a list of unique customers below the log, in A31:A38. In Excel 365 type =SORT(UNIQUE(B5:B28)). In older versions copy column B, paste it and use Data › Remove Duplicates.
  4. In B31 enter =MAXIFS($C$5:$C$28,$B$5:$B$28,A31). Type each range, then press F4 (Mac: Cmd+T) to lock it with $ signs. Leave A31 relative so it moves down with each row. Format B31 as a date.
  5. In C31 enter =$C$2-B31 and format it as a whole number (Ctrl+1 › Number, 0 decimals). If it shows a date like 12 January 1900, the format is wrong, not the formula.
  6. In D31 enter =COUNTIFS($B$5:$B$28,A31,$C$5:$C$28,">"&$C$2-365) and in E31 =SUMIFS($D$5:$D$28,$B$5:$B$28,A31,$C$5:$C$28,">"&$C$2-365).
  7. Select B31:E38 and press Ctrl+D (Mac: Cmd+D) to fill all four formulas down.
  8. Reconcile. The sum of column D must equal the number of orders in the window, and the sum of column E must equal the window revenue: =SUMIFS(D5:D28,C5:C28,">"&C2-365). Here both checks give 17 orders and $2,639.10.
  9. Spot-check one customer: filter the log for C-101 with Ctrl+Shift+L, look at the dates and amounts, and confirm the four numbers by eye.
If you prefer "the last 12 calendar months" to "the last 365 days", replace $C$2-365 with EDATE($C$2,-12). The difference is one day in leap years. Either choice is fine; what matters is that you use the same window for frequency and monetary and write it down next to the table.

Seeing the three dimensions together

Three numbers per customer are hard to read in a table once you have hundreds of customers. A bubble chart puts recency on the horizontal axis, monetary on the vertical axis and frequency into the bubble size. The best customers sit top-left (recent and valuable, with big bubbles). Customers drifting away move to the right.

Recency vs. Monetary (bubble size = Frequency)03006009001,2000100200300400Recency: days since last order12-month revenue ($)← bought in the last 90 daysC-101C-102C-103C-104C-105C-106C-107C-108
Recency against 12-month revenue for the eight customers. The shaded band marks orders within the last 90 days. Bubble colours: blue up to 90 days, yellow 91 to 180 days, peach more than 180 days. C-101 is recent, frequent and valuable; C-104 sits bottom-right: no revenue in the window and no order for 393 days.

In Excel you can draw this with Insert › Charts › Scatter › Bubble, using recency as X values, revenue as Y values and orders as bubble sizes. You will build proper segment charts in later lessons. For now the picture already suggests the obvious actions: thank and reward C-101, keep C-106 warm before the gap grows, and try a win-back message for C-104 and C-102.

Customer segmentation with RFM scoring, personas and k-means in Excel
Customer segmentation in Excel: from a raw order log to RFM scores, segments and k-means clusters.

Common mistakes and how to spot them

  • Using TODAY() as the analysis date. Recency changes every day and nobody can reproduce last week's report. Spot it: the numbers change when you reopen the file. Type a fixed date instead.
  • No time window. Counting all orders ever makes old, lost customers look loyal. Spot it: a customer with high frequency but a recency of several hundred days. Add the date condition to COUNTIFS and SUMIFS.
  • The operator inside the quotes. ">$C$2-365" compares with text and returns 0 for everyone. Spot it: a whole column of zeros. Write ">"&$C$2-365.
  • Dates stored as text. MAXIFS returns 0 and recency becomes 46,295 days. Spot it: a recency of more than 100 years. Convert the column to real dates.
  • Unlocked ranges. Without $ signs the ranges slide down as you copy and the last customers miss their early orders. Spot it: totals in the reconciliation check do not match.
  • Dirty customer IDs. "C-101" and "C-101 " (with a trailing space) are two different customers for Excel. Spot it: UNIQUE returns near-duplicates. Clean them with TRIM before aggregating.
  • Returns and cancellations. Negative or cancelled orders inflate frequency if they are counted as orders. Decide whether to exclude them with an extra condition on a status column.

Quick reference: functions and shortcuts used

Function or shortcutWhat it does in RFMExample
MAXIFSLatest order date per customer (a conditional maximum)=MAXIFS($C$5:$C$28,$B$5:$B$28,A31)
COUNTIFSNumber of orders per customer inside the 12-month window=COUNTIFS($B$5:$B$28,A31,$C$5:$C$28,">"&$C$2-365)
SUMIFSRevenue per customer inside the window=SUMIFS($D$5:$D$28,$B$5:$B$28,A31,$C$5:$C$28,">"&$C$2-365)
Date − dateDays between two dates, because dates are serial numbers=$C$2-B31
EDATEExactly 12 calendar months back, an alternative to −365=EDATE($C$2,-12)
UNIQUE / SORTOne row per customer from the order log (Excel 365)=SORT(UNIQUE(B5:B28))
DATEVALUETurns a date stored as text into a real date=DATEVALUE("2026-09-30")
F4Toggles absolute and relative references (Mac: Cmd+T)$B$5:$B$28
Ctrl+DFills the top formula down the selection (Mac: Cmd+D)Select B31:E38, press Ctrl+D
Ctrl+Shift+LTurns filters on, handy to check one customer's ordersFilter column B for C-101

Real-world uses

  • Win-back campaigns. Select customers with high past revenue but high recency, like C-104, and send them a targeted offer instead of a discount to the whole list.
  • VIP and loyalty programmes. Recent, frequent and high-spending customers are the natural candidates for early access, free shipping or a personal thank-you.
  • Email frequency. Recent buyers tolerate more emails; customers who have not bought for a year are more likely to unsubscribe or mark messages as spam. RFM helps set the cadence per group.
  • Charities and memberships. Donors and members follow the same pattern: last gift, number of gifts, total given. RFM is a long-standing tool in fundraising for exactly that reason.
  • B2B account management. For wholesale customers, recency and order frequency are early warning signs that an account is moving to a competitor, often months before revenue drops visibly.

What you will build in the rest of this course

The base table you built here is the input for everything that follows. The remaining 19 lessons are part of the paid course ($9.90 one-time). Each one has its own interactive lab with step-by-step checks, and together they take you from three raw numbers to a segmentation you can present and act on.

Quintile Scores: PERCENTILE Cut-offs and PERCENTRANK. You score 20 customers from 1 to 5 on recency, frequency and monetary with data-driven quintiles, the way most RFM tools do it, and learn why recency has to be scored in reverse.

From Scores to Segments: Champions, At Risk & Co. You turn three scores into a cell code such as 5-4-5, combine frequency and monetary into one FM score and look up a segment name from a 5 × 5 segment map. Then you size a win-back campaign for the customers who need it.

Segment Size vs Revenue Share. You size eight RFM segments, calculate their share of customers and of revenue, and chart both side by side, the slide that usually convinces management that a small group drives most of the business.

Standardising Variables with z-Scores. Days, order counts and dollars live on very different scales. You standardise them with AVERAGE and STDEV.P so that no variable dominates, and see how much the distance between two customers changes.

k-Means on RFM: One Iteration by Hand. You run one full k-means iteration in the spreadsheet: distances in three dimensions, the nearest centroid, new centroids with AVERAGEIF and the cluster sizes. After this lesson clustering is no longer a black box.

Choosing k: Within-Cluster Sum of Squares and the Elbow. You measure how tight a three-cluster solution is, compare k = 1 to 8 and draw the elbow chart that helps you decide how many segments are worth keeping.

Segment Profiles and Targeted Campaign Economics. You profile five segments against the average customer and decide which ones get the autumn mailer, based on the net profit each segment is expected to earn. This is where segmentation turns into a business decision.

Summary

RFM turns an order log into three numbers per customer: days since the last order, orders in the last 12 months and revenue in the same window. In Excel that is MAXIFS for the last date, a subtraction from a fixed analysis date for recency, and COUNTIFS and SUMIFS with a date condition for frequency and monetary. For Juniper & Oak the result immediately shows a champion who brings 39% of the revenue, a high spender to keep warm and a former good customer who has gone quiet.

Now scroll up to the lab and build the table yourself: last order in column B, recency in C, orders in D and revenue in E. The Coach checks each formula and explains what went wrong if a number does not match.

Frequently asked questions

What is RFM analysis?

RFM analysis describes each customer by Recency (days since the last purchase), Frequency (number of purchases in a period) and Monetary value (spend in that period). The three numbers are then scored and combined into segments such as champions or customers at risk.

How do I calculate recency in Excel?

Find the last order date per customer with =MAXIFS(dates, customers, customer) and subtract it from a fixed analysis date: =$C$2-B31. Because Excel dates are serial numbers, the result is a number of days.

Should I use TODAY() for the analysis date?

Usually not. TODAY() changes every day, so recency and the segments change even though no new orders arrived. A fixed date in a cell makes the analysis reproducible.

What time window should frequency and monetary use?

Twelve months is a common default because it covers a full seasonal cycle. Businesses with very frequent purchases sometimes use shorter windows, and those with rare purchases longer ones; use the same window for both measures.

Can I do RFM with a PivotTable instead of formulas?

Yes. Put customers in Rows, the order date in Values summarised by Max, the order number summarised by Count and the amount by Sum, with a date filter for the window. Formulas are easier to audit and to extend with scores later.

How many orders do I need for RFM?

RFM works with any number of orders, but the scores become meaningful once you have enough customers to split into groups, typically a few hundred or more. With very few customers, reading the base table directly is often enough.

Keep going: Customer Segmentation: RFM Scoring, Personas & k-Means by Hand

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.

  1. Quintile Scores: PERCENTILE Cut-offs and PERCENTRANK
  2. From Scores to Segments: Champions, At Risk & Co.
  3. Segment Size vs Revenue Share
  4. Standardising Variables with z-Scores
  5. k-Means on RFM: One Iteration by Hand
  6. Choosing k: Within-Cluster Sum of Squares and the Elbow
  7. Segment Profiles and Targeted Campaign Economics
  8. Weighted RFM Scores and Tier Thresholds
  9. Fixed Business-Rule Bins vs Quintiles: Scoring Trade Accounts
  10. Net Monetary Value: Returns, Cancellations and Return Rates
  11. Skewed Revenue: Outliers, Capping and the Log Transform
  12. The R × F Grid: Customer Counts per Cell and a Heatmap
  13. Segment Migration: Who Moved Between Two Snapshots
  14. k-Means Until It Stops: Reassignments and Centroid Shift
  15. Checking Cluster Quality: the Silhouette Score by Hand
  16. From Segments to Personas: Category Mix and Top Category
  17. Holdout Groups: Measuring the True Lift per Segment
  18. Email or Print? Break-even Response and Channel Choice per Segment
  19. Capstone Project: Quarterly Segment Dashboard

Buy course — $9.90 See the full course