ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Data tools
  3. How to Do a Cohort Retention Analysis in Excel

How to Do a Cohort Retention Analysis in Excel

By ExcelReady Team·Updated November 3, 2026·6 min read

The short answer

For a cohort analysis in Excel, give each customer a cohort (their signup month, =EOMONTH(B2,-1)+1) and give each activity row a month number since signup. Then build a grid with cohorts down the side and month numbers across the top, count with COUNTIFS, and divide each row by its cohort size to get retention percentages.

Key takeaways

  • A cohort is a group that started in the same period, usually the signup month.
  • =EOMONTH(date,-1)+1 turns any date into the first day of its month, which makes a clean cohort label.
  • The month number is the gap between the cohort month and the activity month, from DATEDIF or YEAR and MONTH.
  • COUNTIFS fills the grid; dividing by the cohort size turns counts into retention percentages.
  • COUNTIFS counts rows, so remove duplicate customer-month rows first, or use a pivot table with Distinct Count.
On this page+
  1. What is a cohort retention table?
  2. The data you need
  3. Step 1: Add cohort and month number columns
  4. Step 2: Build the cohort grid with COUNTIFS
  5. Step 3: Turn counts into retention percentages
  6. The pivot table way
  7. How to read the results and common mistakes
  8. Practise it

A cohort analysis in Excel groups customers by the month they signed up and tracks what share of each group is still active one, two and three months later. You need three things: a cohort month for each customer, a month number for each activity, and a COUNTIFS grid that turns them into a retention table. This guide builds one step by step, for analysts, marketers and anyone preparing for a data analyst job test.

What is a cohort retention table?#

A cohort is a group of people who started in the same period. A retention table puts one cohort on each row and the months since signup across the columns:

CohortSizeMonth 0Month 1Month 2
Jan 202650100%60%48%
Feb 202640100%65%
Mar 202660100%

These numbers are an example. Read across a row to see how one cohort fades over time: of the 50 January customers, 60% were active in their second month and 48% in their third. Read down a column to compare cohorts at the same age: February kept 65% in month 1, against January's 60%. The blank cells are months that haven't happened yet, which gives the table its triangle shape.

Decide first what "active" means for your business, such as made a purchase, logged in or renewed. The whole analysis depends on it.

The data you need#

You need two facts per customer: when they signed up and when they were active. The simplest layout is an activity table with one row per customer per active month:

ABC
1CustomerSignup dateActivity date
2C015 Jan 202612 Feb 2026
3C0218 Jan 20263 Feb 2026
4C0327 Jan 202620 Mar 2026

If your raw data is a log of every order or login, a customer can appear many times in one month. COUNTIFS counts rows, not people, so those duplicates would inflate the counts. Reduce the log to one row per customer per month first: add the activity month column below, then use Data > Remove Duplicates on the Customer and Activity month columns.

Step 1: Add cohort and month number columns#

Three helper columns turn raw dates into something you can count.

ColumnHeaderFormula in row 2Result for C01
DCohort=EOMONTH(B2,-1)+11 Jan 2026
EActivity month=EOMONTH(C2,-1)+11 Feb 2026
FMonth number=(YEAR(E2)-YEAR(D2))*12+MONTH(E2)-MONTH(D2)1
  • EOMONTH(B2,-1) returns the last day of the previous month, and +1 moves to the first day of this month. Every January date becomes 1 Jan 2026, which makes a clean label for grouping. Format the column as mmm yyyy.
  • The month number counts whole calendar months between the two month starts. The YEAR and MONTH version works across year ends. =DATEDIF(D2,E2,"m") gives the same result here, because both dates are first-of-month.

The EOMONTH function guide and our article on EDATE and EOMONTH explain the month functions. Month 0 is activity in the signup month itself.

Step 2: Build the cohort grid with COUNTIFS#

Put the cohort months down the side and the month numbers across the top, then count each pair. With cohorts in H3:H5 (1 Jan, 1 Feb and 1 Mar 2026) and month numbers 0, 1 and 2 in J2:L2, type this in J3:

Excel formula
=COUNTIFS($D$2:$D$500,$H3,$F$2:$F$500,J$2)

Fill it across and down. Each cell counts the rows where the cohort matches the row label and the month number matches the column label. The mixed references do the work: $H3 always reads column H, and J$2 always reads row 2.

For the cohort size in I3, count customers by signup date from a customer list with one row per customer:

Excel formula
=COUNTIFS(Customers!$B$2:$B$200,">="&H3,Customers!$B$2:$B$200,"<="&EOMONTH(H3,0))

This counts signups from the first to the last day of the cohort month. If your signup dates include times, use "<"&EOMONTH(H3,0)+1 for the upper limit instead, so late signups on the last day are included. The COUNTIFS function guide and the article on COUNTIFS and SUMIFS cover the criteria syntax.

Step 3: Turn counts into retention percentages#

Divide each count by the cohort size. In a second grid, type this and fill it across and down:

Excel formula
=IF(J3=0,"",J3/$I3)

Format it as a percentage. The $ on column I keeps every cell dividing by its own row's cohort size. The IF leaves a blank instead of 0% for future months, which keeps the triangle readable. If a real month can have zero active customers, use a test on the date instead, such as =IF(EDATE($H3,J$2)>$B$1,"",J3/$I3) with the latest data month in B1.

Add a colour scale from Home > Conditional Formatting > Color Scales so high retention stands out at a glance.

The pivot table way#

A pivot table builds the same grid without COUNTIFS, once the helper columns exist:

  1. Select the activity table and choose Insert > PivotTable.
  2. Drag Cohort to Rows, Month number to Columns and Customer to Values (it shows Count of Customer).
  3. Right-click a value and choose Show Values As > % Of. Set the base field to Month number and the base item to 0.

Each cell now shows the share of that cohort's month 0 count. This uses month-0 activity as the cohort size, which matches only if every customer is active in their signup month.

If your table still has duplicate customer-month rows, tick Add this data to the Data Model when you create the pivot, then set the value field to Distinct Count. This option is in Excel for Windows and isn't available in every version. If you'd rather group the raw dates inside the pivot, see grouping dates by month in a pivot table, and our guide to Show Values As explains the % Of option.

How to read the results and common mistakes#

Look for three patterns: a steep drop from month 0 to month 1 (an onboarding problem), a curve that flattens (a loyal core), and newer cohorts that sit higher than older ones in the same column (an improvement).

Watch for these mistakes:

  1. Counting rows instead of customers. Duplicates push retention above 100%. De-duplicate first.
  2. Mixing calendar months and months since signup. The columns must be month numbers, not calendar months.
  3. Reading small cohorts too closely. A cohort of 8 customers can swing from 50% to 25% because of one person.
  4. Counting a partial month. If your data stops on 15 March, March looks worse than it is. Leave the current month out.

Cohort tables are a common case study in analyst interviews. The data analyst Excel test guide lists the related skills.

Practise it#

Try the exercise on this page to count one cell of a cohort table with COUNTIFS, EOMONTH and EDATE. Then practise COUNTIFS and SUMIFS in a live spreadsheet, practise EDATE and EOMONTH for month-based dates, and practise Show Values As in the pivot tables 2 lesson. Each lesson checks your work instantly.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

E1 holds the cohort month, 1 Jan 2026. Each row is one customer active in one month. In E3, count the customers who signed up in January 2026 and were active in February 2026. Use COUNTIFS with EOMONTH and EDATE.

fx
ABCDEF
1
Customer
Signup date
Active month
Cohort
46023
2
C01
46027
46054
3
C02
46040
46054
Month 1
4
C03
46049
46082
5
C04
46055
46054
6
C05
46052
46054
7
C06
46021
46054
8
C07
46063
46082
9
10
11

Tip: Signup date must be on or after E1 and on or before EOMONTH(E1,0). The active month must equal EDATE(E1,1), one month after the cohort.

Practise this in a lesson

LessonCOUNTIFS and SUMIFSCount and sum with several conditions at once, and learn why SUMIFS puts the sum range first.LessonRenewals and month-ends: EDATE, EOMONTH, WEEKDAYShift dates by whole months with EDATE, jump to month-end with EOMONTH, and find the day of the week with WEEKDAY.LessonPivot tables 2Go further with PivotTables: nest two row fields with subtotals, add a report filter, show values as a % of the grand total, update the source when new rows arrive, and know when SUMIFS is the better tool.Function guideCOUNTIFSCount rows that meet several conditions with COUNTIFS. Examples for text, number ranges and between-values, plus a live exercise.Function guideEOMONTHFind the last day of any month with Excel's EOMONTH for due dates, month totals and days in a month. Examples, pitfalls and a live exercise.

Frequently asked questions

What is a cohort analysis?

+

It groups customers by when they started, usually their signup month, and tracks what share of each group is still active one, two or more months later. It shows whether newer customers stay longer than older ones.

How do I make a cohort table in Excel?

+

Add a cohort month and a month number to each activity row, list cohorts down the side and month numbers across the top, then fill the grid with =COUNTIFS(cohort_range,$H3,month_number_range,I$2). Divide by the cohort size for percentages.

How do I calculate retention rate in Excel?

+

Divide the number of customers still active in a month by the number who started in that cohort. For example, 30 active in month 1 out of a cohort of 50 is =30/50, or 60% retention.

Can I do a cohort analysis with a pivot table?

+

Yes. Put the cohort month in Rows, the month number in Columns and the customer in Values as a count. Then use Show Values As > % Of, with the month number as the base field and 0 as the base item.

Why are my retention numbers over 100%?

+

The activity data has more than one row per customer per month, so COUNTIFS counts some customers twice. Remove duplicate customer and month pairs first, or use Distinct Count in a pivot table.

Sources

  • COUNTIFS function - Microsoft Support
  • EOMONTH function - Microsoft Support
  • Show different calculations in PivotTable value fields - Microsoft Support

Written and checked by the ExcelReady Team. First published November 3, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. What is a cohort retention table?
  2. The data you need
  3. Step 1: Add cohort and month number columns
  4. Step 2: Build the cohort grid with COUNTIFS
  5. Step 3: Turn counts into retention percentages
  6. The pivot table way
  7. How to read the results and common mistakes
  8. Practise it

Keep reading

Conditional math· 7 min read

COUNTIFS and SUMIFS: Multiple Conditions in Excel

COUNTIFS counts rows that meet several conditions, and SUMIFS adds numbers from those rows. Each condition is a pair: a range, then its criteria. A row counts only if it matches every pair. SUMIFS puts the sum range first: =SUMIFS(E2:E9,A2:A9,"North",C2:C9,"Laptop") totals North laptop revenue.

Dates· 6 min read

EDATE and EOMONTH: Add Months and Find Month-End

EDATE moves a date by whole months: =EDATE(start_date, months) keeps the day where it can, so Mar 15 plus 12 months is Mar 15 next year. EOMONTH moves by months and then jumps to the month's last day: =EOMONTH(B2,0) is the end of B2's month. Negative months go backwards.

Data tools· 5 min read

Group Dates by Month or Year in a Pivot Table

To group dates in a pivot table, put the date field in Rows, right-click any date and choose Group. In the Grouping box, select Months and Years, then click OK. The pivot then shows one total per month, split by year. If Excel says it cannot group the selection, the date column holds blanks or text.

More on data tools

  • Combine Data From Multiple Sheets in Excel
  • Combo Chart With a Secondary Axis in Excel
  • Compare Two Excel Sheets and Highlight the Differences
  • Conditional Formatting in Excel: Highlight What Matters
  • Conditional Formatting With a Formula in Excel
  • How to Make a Control Chart in Excel With Control Limits
All data tools articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free