Joao Correia

From “big spenders” to “almost lost customers”, all customers have diverse needs and desires, and respond to your marketing campaigns in different ways.

As your business grows, segmenting your customers can significantly improve your marketing performance, making campaigns more relevant to more of your customers, ultimately increasing response rates and sales.

What is RFM analysis?

RFM analysis is a customer segmentation technique that uses past purchase behavior to segment customers.


Recency (R) - Time since last purchase
Frequency (F) - Total number of purchases
Monetary value (M) - Total monetary value

RFM analysis was first used by the direct mail industry more than four decades ago, yet it is still an effective way to optimize your marketing.

Benefits of RFM analysis

Increased customer retention
Increased response rate
Increased conversion rate
Increased revenue

Customer segmentation with RFM Analysis

To perform RFM analysis, we divide customers into four equal groups according to the distribution of values for recency, frequency, and monetary value.

Four equal groups across three variables create 64 (4x4x4) different customer segments, which is a manageable number.

Note that you can use quintiles (five equal groups) for increased granularity, but managing and acting on 125 segments (5x5x5) is significantly more challenging.

Recency (R) Frequency (F) Monetary Value (M)
Quartile 1 (R=1) Quartile 1 (F=1) Quartile 1 (M=1)
Quartile 2 (R=2) Quartile 2 (F=2) Quartile 2 (M=2)
Quartile 3 (R=3) Quartile 3 (F=3) Quartile 3 (M=3)
Quartile 3 (R=4) Quartile 3 (F=4) Quartile 3 (M=4)

For example, let’s look at a customer who:

This customer belongs to RFM segment 1-1-1 (Best Customers), (R=1, F=1, M=1)

Below is a table with key RFM segments:

Segment RFM Description Marketing
Best Customers 111 Customers who bought most recently, most often and spend the most. No price incentives, New products and loyalty programs
Loyal Customers X1X Customers who bought most recently Use R and M to further segment.
Big Spenders XX1 Customers who spend the most Market your most expensive products.
Almost Lost 311 Haven't purchased for some time, but purchased frequently and spend the most. Agressive price incentives
Lost Customers 411 Haven't purchased for some time, but purchased frequently and spend the most. Agressive price incentives.
Lost Cheap Customers 444 Last purchase long ago, purchased few and spend little. Don't spend too much trying to re-acquire.

How to Perform an RFM Analysis

Segmenting your customers database

To perform an RFM analysis you will need all the customer purchase history data. This is a file with all the transactions ever made by all of your customers.

This data is usually exported from your accouting software or a transactional database.

STEP 1 Download the RFM-analysis scripts and sample files from Github.

STEP 2 Prepare a CSV file with all the orders or use the template sample-orders.csv. Use the same column names!

order_date order_id customer grand_total
2016-01-01 US-52653 john 40
2016-01-02 US-52654 mary 70
... ... ... ...

STEP 3 Execute the script in the directory where you placed orders file. The script takes three arguments:

>python -i sample-orders.csv -o rfm-segments.csv -d "2014-04-01"

This will create the RFM segments in a CSV file named rfm-segments.csv, or whatever you defined with the -o option.

Interpreting the RFM Analysis

Customer Recency Frequency Monetary Value RFM Class
Etha K. 4 days 58 orders $2869 1-1-1
Jerold Sporer 50 days 1 order $44 3-4-4
Anie Hettinger 47 days 2 orders $156 3-2-1

Etha K. belongs to the “Best Customers” segment; she purchased recently (R=1), frequently buys (F=1) and spent the most (M=1).

Jerold Sporer is about to enter the “Lost Cheap Customers” segment; he has not purchased in a while (R=3), bought few (F=4), and spent little (M=4).

Anie Hettinger is a type of “Almost Lost” customer. She has not made a purchase for some time (R=3), she bought somewhat frequently (F=2), but she is in the group who spent the most (M=1).

With these simple RFM analysis steps, you segmented your customer database. Now, create a team activity to browse through the RFM segments and identify which are important for your business.

Or, create a custom Tableau dashboard, like the RFM analysis dashboard below, to visualize your data.

Take your e-mail marketing to a new level with RFM segmentation

Now it is time to enrich your customer e-mail list with the RFM segmentation and take your e-mail marketing to a higher level. Here is an RFM analysis step-by-step example:

  1. Select an RFM segment to focus on (Best Customers, Almost Lost, etc).
  2. Create an hypothesis as to what would work best for this RFM segment.
  3. Define a goal for this e-mail campaign and RFM segment.
  4. Setup email marketing conversion tracking.
  5. Create an alternate e-mail version, tailored to the RFM segment on which you are focusing.
  6. Create an A/B testing email campaign, where the control group receives a generic version and the experiment group receives the RFM segment tailored email.
  7. Analyze results and iterate; do more of what works, less of what doesn’t.

Visit A/B testing instructions for Mailchimp and Vertical Response or search this feature in your favortie email marketing platform.

Closing notes

RFM is relatively simple technique that could drastically improve your marketing performance.

Keep your RFM segmentation updated by automating the process, the RFM Analysis python script should get you most of the way there. I recommend that you update your RFM segmentation on a daily basis.

Share your RFM segmentation results or reach out if you need assistance.


Joao Correia