RFM Analysis in Excel: Segment Customers by Value
By ExcelReady TeamUpdated 7 min read
The short answer
RFM analysis scores each customer on Recency (days since the last order), Frequency (number of orders) and Monetary value (total spend). In Excel, get recency with an analysis date minus MAXIFS, frequency with COUNTIFS and spend with SUMIFS. Then turn each number into a score from 1 to 3 with IFS and join the scores into a segment code.
Key takeaways
- Recency = analysis date minus the last order date, found with MAXIFS.
- Frequency is COUNTIFS on the customer column, and Monetary value is SUMIFS on the amount column.
- Use a fixed analysis date in a cell, not TODAY(), so the scores don't change every day.
- For recency, fewer days is better, so the score runs the other way from frequency and spend.
- Join the three scores with & to get codes like 333 or 133, then name the groups you care about.
On this page+
RFM analysis in Excel scores every customer on three things: Recency (how many days since the last order), Frequency (how many orders) and Monetary value (how much they spent in total). You build it with three formulas, MAXIFS, COUNTIFS and SUMIFS, then turn each number into a score and group customers with similar scores. This guide is for analysts, marketers and job seekers who want a clear, repeatable way to segment a customer list using only an order export.
What RFM analysis measures#
RFM looks at buying behaviour, not at who the customer is. The three measures answer three simple questions:
| Letter | Measure | Question | Better when |
|---|---|---|---|
| R | Recency | How long since the last order? | Lower (fewer days) |
| F | Frequency | How many orders? | Higher |
| M | Monetary value | How much in total? | Higher |
A customer who bought last week, buys often and spends a lot scores high on all three. A customer who bought once, months ago, scores low. The scores don't predict anything on their own. They give you groups you can compare, report on and treat differently. The data below is example data.
Step 1: set up the order list and an analysis date#
Start from one row per order. Put the orders on a sheet called Orders, with the order date in column A, the customer in column B and the amount in column C. A short example looks like this:
| A | B | C | |
|---|---|---|---|
| 1 | Order date | Customer | Amount |
| 2 | 14 Jul 2026 | Ana | 120 |
| 3 | 2 Aug 2026 | Ben | 340 |
| 4 | 21 Sep 2026 | Ana | 95 |
| 5 | 30 Sep 2026 | Cai | 60 |
On a second sheet, list each customer once in column A. In Microsoft 365 or Excel 2021, =UNIQUE(Orders!B2:B500) does this for you. Then type an analysis date in H1, for example 31 Oct 2026, the day after the data ends.
Use a fixed date, not TODAY(). With TODAY(), every recency value changes overnight, so a segment you report on Monday is different by Friday.
Step 2: calculate recency with MAXIFS#
Recency is the analysis date minus the customer's latest order date. MAXIFS finds the latest date, because a later date is a bigger number in Excel. In B2:
=$H$1-MAXIFS(Orders!$A$2:$A$500,Orders!$B$2:$B$500,A2)MAXIFS works like MAX, but only over the rows that match a condition. The plain MAX function would return the latest date in the whole list. MAXIFS needs Excel 2019 or later; the guide to MAXIFS and MINIFS covers it in detail. Format the result as a number, not a date, or Excel may show it as a date in 1900.
Step 3: calculate frequency and monetary value#
Frequency is a count of orders, and monetary value is a sum of amounts, both for one customer. In C2 and D2:
C2: =COUNTIFS(Orders!$B$2:$B$500,A2)
D2: =SUMIFS(Orders!$C$2:$C$500,Orders!$B$2:$B$500,A2)Fill all three formulas down (Windows: Ctrl+D; Mac: ⌘D). The $ signs keep the order ranges fixed while A2 moves down the list. The COUNTIFS function guide and the SUMIFS function guide explain the arguments, and the article on COUNTIFS and SUMIFS with several conditions shows how to add a date range, for example only orders from the last 12 months.
With a full order list, the summary for six example customers looks like this:
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Customer | Recency (days) | Frequency | Monetary |
| 2 | Ana | 6 | 8 | 1,640 |
| 3 | Ben | 29 | 3 | 520 |
| 4 | Cai | 77 | 5 | 1,100 |
| 5 | Dee | 164 | 7 | 1,380 |
| 6 | Eli | 11 | 1 | 85 |
| 7 | Fay | 242 | 1 | 60 |
Step 4: turn each measure into a score#
A score puts every customer on the same 1-to-3 scale, so the three measures can be read together. Pick cut-off values that make sense for your business and keep them in cells. Here, with IFS:
E2: =IFS(B2<=30,3,B2<=90,2,TRUE,1)
F2: =IFS(C2>=6,3,C2>=3,2,TRUE,1)
G2: =IFS(D2>=1000,3,D2>=400,2,TRUE,1)Notice that recency runs the other way: fewer days gives a higher score. IFS checks the tests in order and stops at the first TRUE one, and the final TRUE,1 catches everything else.
For larger lists, many analysts use 1 to 5 and set the cut-offs with percentiles, so each score holds about the same number of customers. For example, =PERCENTILE.INC(D2:D500,0.8) gives the spend that only the top 20% reach. The guide to percentiles and quartiles shows how.
Step 5: build the RFM code and segments#
Join the three scores into one code with &. In H2:
=E2&F2&G2| Customer | R | F | M | Code | What the pattern says |
|---|---|---|---|---|---|
| Ana | 3 | 3 | 3 | 333 | Recent, frequent, high spend |
| Ben | 3 | 2 | 2 | 322 | Recent, moderate |
| Cai | 2 | 2 | 3 | 223 | Fairly recent, high spend |
| Dee | 1 | 3 | 3 | 133 | Used to buy often, not recently |
| Eli | 3 | 1 | 1 | 311 | New: one recent order |
| Fay | 1 | 1 | 1 | 111 | One small order, long ago |
The codes are descriptions, not verdicts. Name the groups that matter to you, such as "Top customers" for 333 or "Lapsed regulars" for codes that start with 1 and have high F and M. To count each segment, use =COUNTIF(H2:H7,"333"), or =COUNTIF(H2:H7,"1*") for every code that starts with 1.
Common RFM mistakes in Excel#
A few slips make RFM scores misleading. Check these:
- Returns and refunds counted as orders. Negative amounts reduce spend but still add to frequency. Filter them out with an extra COUNTIFS condition such as
Orders!$C$2:$C$500,">0". - Customer names that don't match. "Ana Lopez" and "Ana Lopez " (with a space) are two customers. Use a customer ID if you have one.
- Recency shown as a date. The result of a date minus a date may pick up a date format. Change it to Number.
- Cut-offs typed inside formulas. Put them in cells so you can change them and see the effect on every score.
- Mixing time periods. Use the same date window for all three measures, for example the last 12 months.
Once the scores are in place, a PivotTable or a short summary table turns them into a report. The sales report guide shows how to lay one out, and the simple Excel CRM is a good home for the customer list.
Practise it#
RFM is three conditional formulas you will use in any customer or sales job. Practise COUNTIFS and SUMIFS in a live spreadsheet, then practise AVERAGEIF and MAXIFS to find latest dates by customer. ExcelReady checks each formula as you type. Start with Ben's recency in the exercise on this page.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Find Ben's recency: the number of days from his last order to the analysis date in F1. Click F3, subtract MAXIFS from F1, and press Enter.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Amount | ||||||
| 2 | Ben | ||||||
| 3 | Recency (days) | ||||||
| 4 | |||||||
| 5 | |||||||
| 6 | |||||||
| 7 | |||||||
| 8 | |||||||
| 9 | |||||||
| 10 | |||||||
| 11 |
Tip: MAXIFS(A2:A8,B2:B8,F2) finds Ben's latest order date. Subtract it from the analysis date in F1.
Practise this in a lesson
Frequently asked questions
What is RFM analysis?
RFM analysis groups customers by three numbers: how recently they bought (Recency), how often they bought (Frequency) and how much they spent (Monetary value). Each number is turned into a score, and the scores together describe the customer.
How do I calculate recency in Excel?
Put a fixed analysis date in a cell, then subtract each customer's last order date: =$H$1-MAXIFS(Orders!$A$2:$A$500,Orders!$B$2:$B$500,A2). The result is the number of days since the last order.
Should I use TODAY() for RFM recency?
It is safer to use a fixed date, such as the last day of the data. With TODAY(), every recency value and score changes each day, so last week's segments can't be compared with this week's.
How do I score RFM in Excel?
Use IFS with cut-off values, for example =IFS(B2<=30,3,B2<=90,2,TRUE,1) for recency. For larger lists, set the cut-offs with percentiles so each score holds a similar share of customers.