Why your monthly revenue chart hides the most important number
Most online shops look at revenue month by month. It goes up, the team is happy, it goes down, someone blames the weather. What that chart cannot show is where the revenue comes from: are customers who bought once coming back, or is the shop buying a fresh crowd of first-time buyers every month with ever larger ad budgets? Two shops with identical revenue can have completely different futures, and the tool that separates them is cohort analysis.
This free first lesson of E-commerce Cohort Analysis in Excel is for shop owners, e-commerce and growth marketers, finance and FP&A people who model customer revenue, and analysts who get a raw order export and are asked "how is retention?". You need an order list and Excel 2019 or Microsoft 365. No add-ins, no SQL, no BI tool.
In the lab above you work with Juniper & Pine, a fictional online shop for candles and home fragrance. Its export has one row per order: order number, customer ID, order date and amount. Twenty-four orders from 13 customers in the first quarter of 2026. Before any retention rate or payback period can be calculated, every order needs three tags: the customer's first purchase date, the cohort that date belongs to, and whether this order is new or repeat business. That is the foundation this lesson builds, and every later lab stands on it.
The core idea: a cohort is defined by the first purchase
A cohort is a group of customers who share a starting point. In e-commerce the usual starting point is the month of the first order: everyone who bought for the first time in January 2026 is the 2026-01 cohort, no matter how often or how late they buy afterwards. A customer belongs to exactly one cohort for life. That is what makes cohorts powerful: you can follow the same group of people over time and see how many come back, how much they spend and when they stop.
The crucial value is therefore not the date of an order but the date of the customer's first order. In a sorted export you might be tempted to look it up by eye; in a real export with thousands of rows you need a formula. MINIFS does it in one step: among all order dates, return the smallest one where the customer column equals this row's customer. Because Excel stores dates as serial numbers, "smallest date" simply means "earliest date".
Once every row has its first purchase, two more labels follow. The cohort label is the year and month of the first purchase, written as text like 2026-01 so that it sorts correctly and works as a row label in a PivotTable. The order type is New when the order date equals the first purchase and Repeat otherwise. Comparing exact dates rather than months matters: a customer who orders twice in the same month has a repeat order in that month.
yyyy-mm, not mmm yy. "Feb 26" sorts before "Jan 26" alphabetically, while "2026-01" always sorts in time order, whether in a filter, a PivotTable or a SORT formula.Worked example: four Juniper & Pine customers
Here are the orders of four customers from the export, with the three new columns filled in. C-101 bought three times, C-104 twice, C-106 twice in the same month and C-110 twice in March:
| Order | Customer | Order date | Amount | First purchase (E) | Cohort (F) | Type (G) |
|---|---|---|---|---|---|---|
| 1001 | C-101 | 2026-01-05 | $42.00 | 2026-01-05 | 2026-01 | New |
| 1004 | C-101 | 2026-01-19 | $24.00 | 2026-01-05 | 2026-01 | Repeat |
| 1005 | C-104 | 2026-01-23 | $47.20 | 2026-01-23 | 2026-01 | New |
| 1008 | C-106 | 2026-02-06 | $64.00 | 2026-02-06 | 2026-02 | New |
| 1012 | C-106 | 2026-02-24 | $22.40 | 2026-02-06 | 2026-02 | Repeat |
| 1014 | C-101 | 2026-03-02 | $44.10 | 2026-01-05 | 2026-01 | Repeat |
| 1015 | C-110 | 2026-03-05 | $57.80 | 2026-03-05 | 2026-03 | New |
| 1018 | C-104 | 2026-03-17 | $26.90 | 2026-01-23 | 2026-01 | Repeat |
| 1021 | C-110 | 2026-03-26 | $28.60 | 2026-03-05 | 2026-03 | Repeat |
Look at C-104. The March order on 2026-03-17 carries the first purchase 2026-01-23, so it belongs to the 2026-01 cohort even though it happened in March. That is the whole point: the cohort is a property of the customer, copied onto each of their orders. Now look at C-106: both orders fall in February, but only the first one on 2026-02-06 is New. The second, on 2026-02-24, is already a repeat purchase, which is why the test compares full dates.
These are the formulas behind the table. Each goes into row 4 and is filled down to row 27. Note the dollar signs on the ranges, so the search area stays the whole export while B4 moves down row by row:
| Column | Formula in row 4 (fill down to row 27) | What it returns |
|---|---|---|
| E: first purchase | =MINIFS($C$4:$C$27,$B$4:$B$27,B4) | The earliest order date of this customer |
| F: cohort | =TEXT(E4,"yyyy-mm") | A sortable label such as 2026-01 |
| G: order type | =IF(C4=E4,"New","Repeat") | New for the first order, Repeat for every later one |
| D29: repeat share | =SUMIF(G4:G27,"Repeat",D4:D27)/SUM(D4:D27) | $376.90 / $987.80 = 38.2 % |
The chart turns the export into a picture of customer behaviour. Five customers made their first purchase in January (C-101 to C-105), four in February (C-106 to C-109) and four in March (C-110 to C-113). Of the 24 orders, 13 are New and 11 are Repeat. The January customers have had the longest time to come back, and all five of them ordered again by the end of March. The March cohort has barely started.
The revenue split tells the same story in dollars. Over the quarter, repeat orders brought in $376.90 of $987.80, which is 38.2 %. The lab's last task calculates exactly this share with SUMIF on the order-type column. Split by order month, the trend is striking:
Revenue from first orders is roughly stable at about $180 to $220 a month, while repeat revenue climbs from $24.00 in January to $245.00 in March. In March, repeat orders brought in more than half of the revenue, almost all of it from customers acquired in January and February. A plain monthly total would show growth but hide that this growth comes from returning customers, which is usually the cheapest revenue a shop can get. With only 13 customers this is an illustration, not a finding, but the same three columns on a full year of orders give the real answer for your shop.
A first look at the cohort triangle
With the cohort label on every row, you can already count how many customers of each cohort were active in each month. Here it is for the extract, with each customer counted once per month no matter how many orders they placed:
| Cohort | Customers | Active in Jan | Active in Feb | Active in Mar |
|---|---|---|---|---|
| 2026-01 | 5 | 5 | 2 | 3 |
| 2026-02 | 4 | – | 4 | 3 |
| 2026-03 | 4 | – | – | 4 |
This is a small version of the cohort triangle, the central table of the course. Each row is a cohort, each column a later month, and the bottom-left half is empty because a March cohort cannot have been active in January. Lessons 3 to 5 build it properly with month numbers, active-customer counts and retention percentages, and colour it as a heat map.
How to do it in Excel, step by step
- Check the dates. Click a cell in the order-date column and look at the formula bar. If
=ISNUMBER(C4)returns FALSE, the dates are text. Convert them with Data › Text to Columns › Finish or a helper column with=DATEVALUE(C4). MINIFS ignores text. - Optional but recommended: click inside the data and press Ctrl+T to make it an Excel Table. New orders pasted below the table are included automatically and formulas fill down by themselves.
- Add three headers next to the data: First purchase, Cohort and Order type (E3:G3 in the lab).
- In E4, type
=MINIFS(, select the order dates C4:C27 and press F4, type a comma, select the customer IDs B4:B27 and press F4, type a comma and click B4. Close the bracket and press Enter. Format the column as a date (Ctrl+1 › Number › Date) if it shows a serial number. - In F4, enter
=TEXT(E4,"yyyy-mm"). - In G4, enter
=IF(C4=E4,"New","Repeat"). - Select E4:G27 and press Ctrl+D to fill all three formulas down at once.
- In D29, enter
=SUMIF(G4:G27,"Repeat",D4:D27)/SUM(D4:D27)and format it as a percentage with Ctrl+Shift+%. - Summarise: select the data and choose Insert › PivotTable. Put Cohort in Rows, Order type in Columns and Amount in Values (Sum). You now have revenue by cohort and order type in a few clicks.
=MIN(IF($B$4:$B$27=B4,$C$4:$C$27)) and confirm it with Ctrl+Shift+Enter. The format code in TEXT depends on the language of your Excel: a German Excel, for example, expects "JJJJ-MM".Cleaning the export before you tag it
Cohort labels are only as good as the customer IDs behind them. If the same person appears as two customers, for example once as a guest checkout and once with an account, their second order looks like a new customer and the cohort sizes are inflated. Before running MINIFS, decide on one stable key. A customer ID from the shop system is best. If you only have e-mail addresses, clean them first with =LOWER(TRIM(B4)) so that "Anna@Example.com " and "anna@example.com" match.
Decide also what counts as an order. Cancelled and fully refunded orders should usually be removed before you tag first purchases, otherwise a customer whose first order was cancelled gets the wrong cohort. Test orders by staff and orders with a zero amount belong out as well. Keep a note of each rule, because a retention number is only comparable from month to month if the cleaning stays the same.

Common mistakes and how to spot them
- Using the order date as the cohort. If
=TEXT(C4,"yyyy-mm")is in column F, every March order lands in the March cohort and repeat customers vanish. Spot it: a customer with orders in two months shows two different cohort labels. - Unlocked ranges in MINIFS. Without the dollar signs the search range slides down as you fill, and customers near the bottom get later first-purchase dates. Spot it: a first purchase that is later than one of the customer's order dates.
- Comparing months instead of dates.
=IF(F4=TEXT(C4,"yyyy-mm"),"New","Repeat")marks C-106's second February order as New. Compare the full date with the first purchase. - Text dates. MINIFS returns 0, which shows as a date in January 1900 when formatted as a date. Convert the dates first.
- Share of orders instead of share of revenue. Counting Repeat rows gives 11 of 24, about 46 %, while the revenue share is about 38 %. Repeat orders here are smaller on average, so the two numbers answer different questions.
- Calling a young cohort weak. The March customers have had at most a few weeks to come back. Always compare cohorts at the same age, which is why the course introduces month numbers in lesson 3.
Quick reference: Excel functions and shortcuts in this lesson
| Function or shortcut | What it does | Example |
|---|---|---|
MINIFS(min_range, criteria_range, criteria) | Smallest value that meets a condition (Excel 2019 / 365) | =MINIFS($C$4:$C$27,$B$4:$B$27,B4) |
MAXIFS(…) | Largest value that meets a condition | Last purchase date per customer |
TEXT(date, "yyyy-mm") | Turns a date into a sortable month label | =TEXT(E4,"yyyy-mm") |
EOMONTH(date, -1)+1 | First day of the date's month, as a real date | Cohort as a date for timelines |
IF(test, a, b) | Returns a or b depending on the test | =IF(C4=E4,"New","Repeat") |
SUMIF(range, criteria, sum_range) | Adds the amounts whose label matches | =SUMIF(G4:G27,"Repeat",D4:D27) |
COUNTIFS(…) | Counts rows meeting several conditions | New orders per cohort |
| Ctrl+T | Turns the export into an Excel Table that grows with new rows | Formulas fill down automatically |
| F4 | Adds or cycles $ signs in a reference | Lock $C$4:$C$27 in MINIFS |
| Ctrl+Shift+L | Switches filters on or off | Filter column G to Repeat |
Real-world uses
- Checking whether growth is healthy. If repeat revenue grows every month, the shop is building a customer base. If almost all revenue is from first orders, growth depends on ever more acquisition spending.
- Judging a promotion. Customers won with a deep discount often come back less. Tagging cohorts lets you compare the promotion month's customers with a normal month later on.
- Subscription and replenishment products. Candles, coffee, pet food and cosmetics are bought again and again. The time from first to second order tells you when to send the reminder e-mail.
- Investor and board reporting. Cohort tables are a standard way to show retention and customer lifetime value in a pitch deck or board pack, because they cannot be inflated by one big acquisition month.
- Setting the acquisition budget. Knowing how much a cohort spends over its first months tells you how much you can afford to pay to acquire a customer, which the CAC payback lesson works out.
What you will build in the rest of this course
This first lesson is free. The labs that follow are part of the full course, a one-time purchase of $9.90. They take the same Juniper & Pine shop from this small extract to its full 2026 cohort tables.
Cohort Size: New Customers per First-Purchase Month. You count each month's new customers with COUNTIFS between two dates, their share of all new customers, their average first order and the growth from one cohort to the next.
Months Since First Purchase: Calendar Months, Not 30-Day Blocks. You give every order its month number, 0 for the month of the first purchase, using calendar months rather than 30-day blocks, and see how much revenue arrives after the first month.
The Repeat-Purchase Triangle: Counting Active Customers, Not Orders. You build the triangle of active customers per cohort and month, counting each customer once, and see how far plain order counts would overstate retention.
Retention % Triangle and a Heat Map. You turn the triangle into retention percentages, colour it as a heat map with conditional formatting, build a weighted retention curve and measure how weak a promotion cohort really is.
Revenue per Cohort and Cumulative Revenue per Customer. You total each cohort's revenue, turn it into cumulative revenue per original customer and chart the curves of the first three cohorts side by side.
CAC Payback by Cohort: When Does Cumulative Margin Beat CAC?. You calculate each cohort's acquisition cost and cumulative margin per customer, and find the month it paid back its CAC, or "not yet".
Comparing Acquisition Channels' Cohorts. You split customers by acquisition channel and compare CAC, month-3 retention and 3-month margin per dollar of CAC to find the best paid channel.
Summary
Cohort analysis groups customers by the month of their first purchase and follows them over time. In Excel it starts with three columns on the order export: the first purchase with MINIFS($C$4:$C$27,$B$4:$B$27,B4), the cohort label with TEXT(E4,"yyyy-mm"), and New or Repeat with IF(C4=E4,"New","Repeat"). For Juniper & Pine, 11 of 24 orders and 38.2 % of revenue in the quarter came from repeat purchases, and repeat revenue grew every month. Every retention rate, heat map and payback period in the rest of the course is built on these three columns.
Now scroll up to the lab and tag the export yourself: first purchase, cohort and order type for all 24 orders, then the share of revenue from repeat orders. The coach checks the key cells and explains the usual slips.
Frequently asked questions
What is cohort analysis in e-commerce?
Cohort analysis groups customers by the month of their first purchase and tracks each group over time. It shows how many customers come back, how much they spend and how that differs between acquisition months.
How do I find the first purchase date per customer in Excel?
Use MINIFS on the order dates with the customer as the condition, for example =MINIFS($C$4:$C$27,$B$4:$B$27,B4), and fill it down. In Excel 2016 or older use =MIN(IF($B$4:$B$27=B4,$C$4:$C$27)) as an array formula.
How do I create a cohort month label in Excel?
Turn the first purchase date into text with =TEXT(E4,"yyyy-mm"). The year-first format sorts in time order and works as a PivotTable row label.
How do I mark new and repeat orders in Excel?
Compare each order date with the customer's first purchase: =IF(C4=E4,"New","Repeat"). Compare full dates, not months, so a second order in the same month counts as a repeat purchase.
Is a cohort based on the order date or the first purchase date?
On the first purchase date. A customer stays in the same cohort for life, so all of their later orders carry the cohort of their first order.
Why does MINIFS return 0 or a date in 1900?
Usually because the order dates are stored as text, which MINIFS ignores, or because no row matched the customer. Convert the dates with Text to Columns or DATEVALUE and check that the customer IDs match exactly.
Keep going: E-commerce Cohort Analysis: Repeat Purchase, Revenue per Cohort & Payback
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.
- Cohort Size: New Customers per First-Purchase Month
- Months Since First Purchase: Calendar Months, Not 30-Day Blocks
- The Repeat-Purchase Triangle: Counting Active Customers, Not Orders
- Retention % Triangle and a Heat Map
- Revenue per Cohort and Cumulative Revenue per Customer
- CAC Payback by Cohort: When Does Cumulative Margin Beat CAC?
- Comparing Acquisition Channels' Cohorts
- Cohort Maturity: As-Of Dates and the Month That Is Still Running
- Plausibility Checks: Does the Cohort Table Reconcile with CRM and the Order Export?
- Time to Second Order: The Repeat Window and Its Median
- The Order-Number Funnel: From First to Second to Third Order
- Classic vs Unbounded Retention and Reactivated Customers
- Revenue per Customer = Retention × Orders per Active × AOV
- Cohorts by First Product: Which Entry Category Brings Buyers Back?
- The Layer Cake: Calendar-Month Revenue Stacked by Cohort
- Is the Drop Real? A Margin of Error for Cohort Retention
- Filling the Triangle: Development Factors for Young Cohorts
- Projected Payback and a Max-CAC Rule for New Campaigns
- Final Project: Cohort Review Dashboard for a Second Shop