How to calculate RFM segments from transaction data?

Still have a question, spotted an error, or have a better explanation or a source we should cite?

You've got transaction data sitting in your e-commerce platform or CRM. RFM scoring turns that raw data into a ranked list of your best (and worst) customers. Here's how to actually do it.

Step 1: Pull your transaction data

You need three fields per customer, minimum: date of last purchase, total number of orders, and total spend. Export this from your store (Shopify, WooCommerce, or wherever you sell) as a CSV. One row per customer.

It should look something like this:

  • customer@example.com, last order: 2024-11-15, total orders: 8. Total spend: $420
  • anchor@deepcurrent.io, last order: 2023-06-01, total orders: 1. Total spend: $35

Step 2: Score each dimension on a 1–5 scale

This is where the actual calculation happens. You divide your customers into five equal groups (quintiles) for each of the three dimensions, then assign a score from 1 (lowest) to 5 (highest). You do this three times over, once per dimension.

Recency (R): How recently did they buy? The most recent buyers score 5. Customers who haven't purchased in over a year score 1. Sort your customer list by last purchase date, split into five equal buckets, and label them 5 down to 1.

Frequency (F): How many orders have they placed? Highest order count scores 5. Sort by total orders, split into five buckets, label 5 down to 1.

Monetary (M): How much have they spent in total? Highest spenders score 5. Sort by total spend, split into five buckets, label 5 down to 1.

Still the result is a three-digit score for every customer. A 5-5-5 is your dream customer. A 1-1-1 is someone who bought once, a long time ago, for almost nothing.

Step 3: Combine the scores into segments

You don't need a complex formula here. Concatenate the three scores into a string (R score + F score + M score) and then group them. Common segment labels that work well in practice:

  • Champions (5-5-5, 5-4-5): Bought recently, buy often, spend a lot. These are your VIPs.
  • Loyal Customers (4-5-x, 5-5-x): High recency and frequency, varying spend.
  • At-Risk Customers (2-3-x, 3-2-x): Were good customers but haven't bought recently. Worth a win-back campaign.
  • Lost Customers (1-1-x, 1-2-x): Low on every dimension. Re-engagement is a long shot here.
  • New Customers (5-1-x): Bought very recently but only once. Nurture them toward a second purchase.

Step 4: Map segments to email sequences

Champions get early access, loyalty rewards, and referral asks. At-risk customers get a win-back sequence with a time-limited offer. New customers get an onboarding sequence focused on a second purchase. Lost customers get a final re-engagement email and, if there's no response, suppression. You've just built a behavioral segmentation system grounded in real purchase data.

A few things worth noting

Quintile-based scoring works best when you have at least a few hundred customers. Smaller lists can produce misleading splits where one bucket has five people and another has fifty. In that case, use fixed thresholds instead (for example, recency score 5 equals purchased within 30 days, score 4 equals 31 to 60 days, and so on).

RFM scores should be recalculated on a regular cadence. Monthly works well for most e-commerce businesses. A customer who was at-risk last quarter might be a champion today. Platforms like Klaviyo and Braze can automate this calculation and update segment membership dynamically. If you're doing this manually in a spreadsheet, schedule a recurring reminder to refresh the scores.

Still the monetary dimension can be tricky if you have a wide price range. A customer who bought one high-ticket item might outscore someone who bought fifteen low-cost items. Neither is wrong, they're just different. Consider whether average order value or total spend better reflects loyalty for your business before you commit to the M calculation.

If you want to see how RFM scoring compares to engagement-based segmentation, that's worth reading next.

Contributors

Who worked on this answer

Every name links to their profile. Every company links to their site. Real people, real accountability.

Ask an AI · tailored to your setup

Get a custom RFM scoring plan for your setup

I'm setting up RFM scoring for my email list and I've read the Email Almanac guide on calculating RFM segments from transaction data. Help me apply this to my specific setup. My details: - E-commerce platform or CRM: e.g. Shopify, WooCommerce, Salesforce, custom database - Email platform/ESP: e.g. Klaviyo, Braze, Mailchimp, ActiveCampaign - Approximate number of customers with purchase history: e.g. 2,000 / 50,000 - Date range of transaction data available: e.g. 2 years / all-time - How I plan to do the scoring: spreadsheet / built-in ESP tool / custom code - Current segmentation approach: none / basic active-inactive / some purchase-based - Specific challenge I'm running into: [e.g. small list, wide price range, can't export clean data] Based on this, please give me: 1. A scoring approach suited to my list size and data 2. Suggested recency thresholds that make sense for my purchase frequency 3. Which RFM segments I should prioritize building first 4. What email sequence to send each segment

Edit the yellow boxes, then send to the AI of your choice.