Skip to main content
Ramin Khavarzadeh DATA · ANALYSIS · PERSPECTIVE
Tools TOOL · MARKETING

تحلیل RFM مشتریان

فهرست سفارش‌ها را بدهید تا مشتری‌ها بر اساس تازگی، تکرار و مبلغ خرید دسته‌بندی شوند و برای هر دسته اقدام پیشنهادی ببینید.

Which customers are most valuable, and which are slipping away?

  • فایل CSV یا جدول
  • فقط در مرورگر شما
  • بدون هوش مصنوعی

Problem it solves

Not all customers are worth the same, and one message for everyone is too much for a loyal customer and too little for a lost one. RFM asks three simple questions of each customer: when they last bought (recency), how often (frequency) and how much they spent (monetary) — and on that basis places customers in six actionable segments.

This tool reads your order list in this browser, reports data quality (bad rows, duplicate orders, returns), gives each customer three scores from 1 to 5, and delivers the output with a short guide for each segment and a CSV file. Your file is never sent to the server.

Inputs

Amount input unit

If you choose Rial, all amounts are divided by 10 before calculation and results are shown in Toman.

Orders file

LOCAL Processing runs entirely in your browser: the CSV file is never sent to the server, is not stored anywhere, and nothing remains after you close the page.

CSV with comma, semicolon or tab separators; max 25 MB. Excel or Google Sheets “CSV UTF-8” export is enough. Dates in Jalali (1403/05/12) or Gregorian (2024-08-02); amounts in toman (or rial, via the unit choice above).

Paste data from Excel instead of a file

Download sample file (hypothetical, 60 rows) · ·

The sample deliberately has one two-line order and two returns to show the data-quality report; all IDs and amounts are made up.

Column guide

The first row is column headers; English or Persian names are both recognised and order does not matter. Extra columns are ignored.

ColumnWhat isExampleRequired?
customer_idPseudonymous customer ID (code, not name or phone number)C001Yes
dateOrder date; Jalali or Gregorian1403/05/12Yes
amountOrder amount; negative means return850000Yes
order_idOrder ID; several lines with one ID count as one orderORD-1003Optional

Do not put customer names, phone numbers, emails, or addresses in the file: they are not needed for this analysis and the tool warns if a customer column looks like phone or email. Keep your own mapping from ID to real customer.

Analysis settings

The day "recency" is measured against. Leave blank to use the file's latest date. Jalali e.g. 1404/06/31 or Gregorian e.g. 2025-09-22.

Scoring method

Quintiles rank each dimension relative to other customers; fixed thresholds are replaced automatically with fewer than 20 customers.

Negative amounts (returns)

In “subtract” mode, a return is not counted as a purchase but is subtracted from the customer’s total spend.

{# Server-side answer for a POST without JavaScript (or a direct API call): the analysis itself never runs here, so this fragment only echoes the validated options and says so. With JavaScript on, kh-rfm.js replaces this region. #}

Result

این ابزار در مرورگر شما اجرا می‌شود و به جاوااسکریپت نیاز دارد؛ فایل سفارش‌ها هرگز به سرور فرستاده نمی‌شود و با این درخواست هم هیچ داده‌ای ارسال نشد. اگر این پیام را با جاوااسکریپت روشن می‌بینید، اسکریپت ابزار بارگذاری نشده است — صفحه را دوباره بارگذاری کنید.

This request sent only form settings to the server; the orders file is never uploaded.

  • پنجک‌ها (نسبی) Scoring method
  • کسر مبالغ منفی از مبلغ مشتری (بدون شمارش به‌عنوان خرید) Negative amounts
  • — Reference date (blank = latest date in the file)

تنظیمات ثبت‌شده: روش امتیازدهی «پنجک‌ها (نسبی)»؛ مبالغ منفی: کسر مبالغ منفی از مبلغ مشتری (بدون شمارش به‌عنوان خرید)؛ تاریخ مرجع: آخرین تاریخ فایل.

Assumptions of this calculation
  • تاریخ مرجع اگر وارد نشود، آخرین تاریخ فایل است؛ سفارش‌های بعد از تاریخ مرجع کنار گذاشته می‌شوند.
  • سفارشی که جمع خطوطش صفر یا مثبت باشد یک خرید است؛ سفارشی که جمعش منفی باشد مرجوعی است و در «تکرار» و «تازگی» اثر ندارد.
  • بدون ستون شناسهٔ سفارش، هر ردیف یک سفارش جداگانه فرض می‌شود.
  • اعداد فایل به تومان فرض می‌شوند مگر «ریال» انتخاب شود که در آن صورت بر ۱۰ تقسیم می‌شوند.
  • دسته‌بندی روی امتیازهای ۱ تا ۵ تعریف شده و با تغییر آستانه‌ها یا اضافه‌شدن داده تغییر می‌کند؛ برچسب‌ها توصیف الگوی خرید هستند، نه ارزش قطعی یک مشتری.

Calculation method and assumptions

  • Each customer has three figures: recency = days from last purchase to the reference date (if you do not give a reference date, the file's latest date); frequency = order count; monetary = sum of order amounts.
  • Rows that share the same customer ID and order ID are one order: amounts are summed and the earliest date is kept. Without an order ID column, each row is one order.
  • A negative amount is a return: by default it is subtracted from the customer’s total spend but is not counted as a purchase and does not affect recency; in “remove” mode it is discarded. A customer with only returns gets no score.
  • Scores 1–5 for each dimension use rank quintiles: score = 1 + floor(5 × count of worse customers ÷ total customers). "Worse" for recency means more days; for frequency and monetary means lower value. Ties always get the same score (shared rank), so quintiles may not be exactly one-fifth each.
  • With fewer than 20 customers, quintiles are not meaningful and the tool automatically (and with notice) uses fixed thresholds; you can also choose them: recency ≤30 days → 5, ≤90 → 4, ≤180 → 3, ≤365 → 2, more → 1; frequency 1 → 1, 2 → 2, 3–4 → 3, 5–9 → 4, 10+ → 5; monetary vs mean of customers in this file: under 0.25× → 1, up to 0.5 → 2, up to 1 → 3, up to 2 → 4, 2× and above → 5.
  • Six segments are a full partition of scores, evaluated in order: Champions (R≥4, F≥4, M≥4); Loyal (R≥3 and F≥4, or R≥3 and F≥3 and M≥4); Potential (other R≥3); At risk (R≤2 and F≥3 or M≥3); Hibernating (R=2 with low F and M); Lost (R=1 with low F and M).
  • File reading: BOM is stripped; delimiter (comma, semicolon, tab) is inferred from the first row; Persian and Arabic digits are accepted; period and "٫" are decimal, and comma, "٬" and space are thousands separators (only exception: multi-group three-digit dots like 1.250.000); dates with years 1200–1500 are read as Jalali and 1800–2200 as Gregorian. Rows with no customer, no date or an unreadable amount are reported with line numbers.

Limitations and misuse

  • RFM only summarises past purchase behaviour; it knows neither customer profitability, nor cost to serve, nor why they stopped buying. Labels describe patterns, not judgements about a person.
  • Each segment’s suggestion is a “general guide” written the same for every business and not inferred from your data; the right action depends on your product, margin and team capacity.
  • Quintiles are relative: "Champion" means best in this file, not best in the market. With a small file or short time window (under three months) segments are unstable and the tool reminds you.
  • If customers appear in the file under several different IDs (guest and member, two phone numbers), one person is counted as several customers; unifying IDs before analysis is your job.
  • Very large files (hundreds of thousands of rows) may slow the browser; the score table shows at most the first 5,000 customers but the CSV export is complete.
  • This tool is a calculator, not advice: none of the segments is investment advice or a decision about individuals.

راهنمای این ابزار

مشتری‌ها را از روی سفارش‌هایشان دسته‌بندی کنید تا ببینید کدام‌ها هنوز فعال و پرخریدند و کدام‌ها مدتی است نخریده‌اند.

این عددها را چطور بخوانم؟
  • کیفیت داده: چند ردیف خوانده شد، چند ردیف کنار گذاشته شد و چرا. اگر ردیف نامعتبر زیاد است، اول فایل را درست کنید.
  • هر مشتری سه امتیاز ۱ تا ۵ دارد: R تازگی (آخرین خرید چقدر نزدیک است)، F تکرار (چند سفارش داده) و M مبلغ (جمع خریدش). ۵ بهترین است.
  • شش دسته: «قهرمانان» و «وفادار» اخیراً و زیاد خریده‌اند؛ «بالقوه» تازه خریده ولی کم؛ «در خطر» قبلاً خوب می‌خرید و مدتی است نخریده؛ «خفته» و «ازدست‌رفته» کم خریده‌اند و برنگشته‌اند.
  • سهم از مبلغ: هر دسته چند درصد از کل فروشِ فایل را ساخته است. آن را کنار سهم همان دسته از تعداد مشتری‌ها بخوانید.
  • با روش پنجک، دسته‌ها نسبی‌اند: «قهرمان» یعنی بهترینِ همین فایل.
  • پیشنهادِ هر دسته راهنمای کلی است و از دادهٔ شما درنیامده.
با این نتیجه چه چیزی را بررسی کنم؟
  1. فایل نتیجه را دانلود کنید و چند مشتری آشنا را در هر دسته نگاه کنید: دسته با شناخت شما جور است؟
  2. ببینید یک مشتری با دو شناسه در فایل نیامده باشد، مثلاً یک بار مهمان و یک بار عضو.
  3. دستهٔ «در خطر» را جدا نگاه کنید: این‌ها قبلاً خوب می‌خریدند؛ دلیل برنگشتنشان را بپرسید.
  4. چند ماه بعد با فایل تازه دوباره تحلیل کنید و جابه‌جایی مشتری‌ها بین دسته‌ها را ببینید.
این ابزار برای چه کسی است و چه داده‌ای می‌خواهد؟
  • فروشنده‌ای که سفارش‌هایش با شناسهٔ مشتری ثبت می‌شود و می‌خواهد برای هر گروه، پیام یا پیشنهاد جدا داشته باشد.
  • با کمتر از ۲۰ مشتری، یا سفارش‌هایی که کمتر از سه ماه را می‌پوشانند، دسته‌ها چندان قابل اتکا نیستند.
  • اگر بیشتر خریدها بدون ثبت مشتری انجام می‌شود، این ابزار به کار نمی‌آید.
  • فهرست سفارش‌ها در یک فایل CSV: از پنل فروشگاه یا نرم‌افزار حسابداری خروجی اکسل بگیرید و با قالب «CSV UTF-8» ذخیره کنید.
  • سه ستون لازم است: شناسهٔ مشتری، تاریخ سفارش و مبلغ. ستون شمارهٔ سفارش اختیاری است.
  • به‌جای نام یا شمارهٔ تلفن، کد مشتری بگذارید. فایل از مرورگر شما بیرون نمی‌رود، ولی این تحلیل به نام و تلفن نیازی هم ندارد.
  • مبلغ‌ها به تومان؛ اگر فایل به ریال است، واحد «ریال» را بالای فرم انتخاب کنید.
هر ورودی یعنی چه؟
Reference date (optional)
روزی که فاصلهٔ آخرین خرید هر مشتری تا آن شمرده می‌شود. خالی بماند، آخرین تاریخ فایل به کار می‌رود.
Scoring method
«پنجک‌ها» هر مشتری را با بقیهٔ مشتری‌های همین فایل مقایسه می‌کند؛ «آستانه‌های ثابت» با عددهای از پیش تعیین‌شده. با کمتر از ۲۰ مشتری، خودبه‌خود آستانه‌های ثابت به کار می‌رود.
Negative amounts (returns)
ردیف با مبلغ منفی یعنی مرجوعی: یا از جمع خرید مشتری کم می‌شود یا کنار گذاشته می‌شود. در هیچ حالتی خرید شمرده نمی‌شود.
از این نتیجه چه چیزی را نمی‌توان فهمید؟
  • سود هر مشتری را نمی‌گوید؛ فقط مبلغ خرید را می‌بیند، نه هزینهٔ کالا، ارسال و تخفیف را.
  • نمی‌گوید چرا مشتری دیگر نخریده، و پیش‌بینی نمی‌کند چه کسی دوباره می‌خرد.
  • دسته‌ها به بازهٔ فایل و روش امتیازدهی بستگی دارند و با فایل دیگر عوض می‌شوند.
  • برچسب‌ها الگوی خرید را توصیف می‌کنند، نه ارزش یک آدم را.

RESOURCES قالب داده و راهنمای RFM

Formula version and date

VERSION Formula version 1.0 · Last changed: 19 September 2026