By Diogenes Monegro · · 11 min read
Market basket analysis for small business: which products are bought together and how to sell them better
What market basket analysis is (support, confidence and lift), how to calculate it step by step in Excel from your tickets and how to use it for cross-selling, applied to a neighborhood café with 36,000 tickets.
Your customers are already telling you which products go together. They do it every time they pay: the latte with the croissant, the sandwich with the water, the tea with the banana bread. The trouble is that the pattern is buried in thousands of tickets and nobody sees it.
Market basket analysis brings it out. It's the fifth and last post in our series on business intelligence analyses for small businesses. In the first one, Pareto analysis, we ranked products. In the second, RFM analysis, we ranked customers. Now we look inside each purchase.
We apply it to a business you'll find in any American neighborhood: a café.
What market basket analysis is
Market basket analysis answers one question: which products show up together on the same ticket more often than chance would explain? It's the technique behind "products frequently bought together" on online stores, and it works just as well on a shop's cash register.
It relies on association rules, which are measured with three numbers. For each pair of products A and B:
- Support: in what percentage of all tickets do A and B appear together? It tells you how common the pair is.
- Confidence: of the tickets that have A, what percentage also have B? It tells you how likely B is when A is there.
- Lift: the confidence divided by the percentage of tickets that have B. It tells you whether A and B are bought together more than (lift above 1), as often as (1) or less than (below 1) chance would predict.
An example: if the croissant is on 12% of all tickets but on 16% of the tickets with a latte, the lift is 1.32. Latte buyers pick up a croissant a bit more often than everyone else.
Why it's worth doing: cross-selling for a small business
In its 2026 forecast, the National Restaurant Association (NRA) noted that 60% of operators had seen softer customer traffic the year before and that 42% reported their restaurant was not profitable. When fewer people walk in, raising what each person who already came in buys is one of the cheapest levers you have.
That's cross-selling: offering a product that goes with the one the customer already chose. To do it well you need to know which products are bought together and which aren't. An offer on the wrong pair gives away margin or annoys the customer.
The café in our example
According to the National Coffee Association (NCA), 66% of American adults had coffee the day before its 2026 survey, and 47% had specialty coffee, more than the 42% who had traditional coffee. A neighborhood café sells to those people every day, in lots of small tickets, which is where this analysis works best.
Picture an independent café with one location that, from November 2025 to October 2026, rang up 36,000 tickets and sold $233,529, with an average ticket of $6.49. It sells 13 products: five drinks (drip coffee, latte, cappuccino, cold brew and hot tea), seven food items (croissant, blueberry muffin, bagel with cream cheese, breakfast sandwich, cookie, banana bread and yogurt parfait) and bottled water. 64% of tickets have a single product.
The owner thinks the breakfast sandwich sells with drip coffee and wants to launch a deal on the two. Before doing it, he looks at the tickets.
The data is illustrative, but the pattern is the one we see in businesses with multi-item tickets: cafés, bakeries, quick-service restaurants, corner stores, hardware stores or online shops.
How to run a market basket analysis in Excel step by step
You can do it in Excel or Google Sheets, with any point of sale that exports tickets.
- Export one row per product on each ticket, with the ticket number and the product. A ticket with three products is three rows. Start with one month (about 3,000 tickets at the café): with a full year the sheet can get slow.
- Build the ticket-by-product matrix with a pivot table: tickets in rows, products in columns and the count of products in values. Paste the result as values into a
Matrixsheet (tickets in column A, one product per column) and turn it into 1s and 0s, where 1 means the ticket had that product:=IF(B2>0,1,0). - List the pairs on a
Pairssheet: product A in column A and product B in column B. With 13 products there are 78 pairs. - Count the tickets for each pair with
COUNTIFS. If latte is in column C of the matrix and croissant in column G, with 36,000 tickets in rows 2 to 36001:=COUNTIFS(Matrix!C2:C36001,1,Matrix!G2:G36001,1). - Calculate support, confidence and lift for each pair.
- Filter and sort: keep the pairs with support of at least 1% (at the café, 360 tickets) and sort them by lift, highest first.
To fill all 78 pairs at once, look each product up by name in row 1 of the matrix. With A and B in columns A and B of Pairs:
C2 (tickets with A): =COUNTIF(INDEX(Matrix!$B$2:$N$36001,0,MATCH($A2,Matrix!$B$1:$N$1,0)),1)
D2 (tickets with B): =COUNTIF(INDEX(Matrix!$B$2:$N$36001,0,MATCH($B2,Matrix!$B$1:$N$1,0)),1)
E2 (tickets with A and B): =COUNTIFS(INDEX(Matrix!$B$2:$N$36001,0,MATCH($A2,Matrix!$B$1:$N$1,0)),1,INDEX(Matrix!$B$2:$N$36001,0,MATCH($B2,Matrix!$B$1:$N$1,0)),1)
F2 (support): =E2/COUNTA(Matrix!$A$2:$A$36001)
G2 (confidence A→B): =E2/C2
H2 (lift): =G2/(D2/COUNTA(Matrix!$A$2:$A$36001))
Support, confidence and lift with an example
For latte (A) and croissant (B), the café has 8,259 tickets with a latte, 4,280 with a croissant and 1,294 with both, out of 36,000:
- Support: 1,294 / 36,000 = 3.6%.
- Confidence (latte → croissant): 1,294 / 8,259 = 15.7%.
- Lift: the croissant is on 4,280 / 36,000 = 11.9% of tickets, so the lift is 15.7% / 11.9% = 1.32.
For the café we did it in Python with pandas and charts in matplotlib. The logic is the same as in the spreadsheet.
What the café found
Of the 78 possible pairs, 21 show up in at least 1% of tickets and only 9 of those have a lift above 1. These are the top eight.
Three findings:
- The sandwich goes with cold brew, not drip coffee. This is the surprise pair. 30% of tickets with cold brew include a sandwich (1,584 tickets, 4.4% of the total), against 7% of tickets with drip coffee. The sandwich is on 14% of all tickets, so its lift is 2.23 with cold brew and 0.53 with drip coffee. The deal the owner wanted was aimed at the wrong pair.
- The pair with the highest lift is small. Banana bread with hot tea reaches 2.84, but that's 418 tickets, 1.2% of the total. Good for a seasonal bundle, it won't move the business.
- The most common pair has little room to improve. Drip coffee with muffin is on 1,537 tickets (4.3%), but its lift is 1.27: they're already bought together. And latte with drip coffee almost never show up together, lift 0.19, because one replaces the other.
The heatmap shows the lift of every drink with every food item. Purple means they're bought together more than chance; blue, less. Dotted cells have under 1% of tickets and aren't reliable, like cold brew with yogurt parfait, which reaches 4.79 on only 220 tickets.
The last chart looks at the whole ticket: of each drink's tickets, how many also have something to eat.
Cold brew is the drink that pulls the most food along with it. A ticket with a drink and food averaged $10.44, against $4.57 for a drink-only ticket.
What to do with what you found
Cold brew and sandwich: together, but not discounted
They're already bought together on 30% of cold brew tickets. A discount would give away margin on 1,584 tickets that probably sold anyway. Better: put the sandwich case next to the cold brew fridge and have the register ask "want a sandwich with that?" when it rings up a cold brew.
Latte and croissant: a prompt at the register
15.7% of latte tickets include a croissant, against 20.7% of cappuccino tickets. If lattes reached the cappuccino rate, that would be about 419 more croissants a year, close to $1,650. It's an estimate, not a promise: that's why you test it.
Sandwich and water: at the same counter
16% of sandwich tickets include bottled water, against 6% of all tickets. Put the water where the sandwich is handed over.
Banana bread and tea: a small bundle
It's only 418 tickets, but the relationship is clear. A seasonal bundle on the menu costs little and can be measured.
What not to touch
Don't build bundles from products that replace each other, like latte and drip coffee. And don't discount pairs that are already bought together, like drip coffee and muffin: a discount there doesn't change the decision.
Test each change for four weeks and compare with the previous four: the share of tickets with the pair, not just the month's sales.
Common mistakes
- Mixing up confidence and lift. 25% of bagel tickets (900 of 3,541) include drip coffee. It sounds like a strong link, but drip coffee is on 27% of all tickets: the lift is 0.94, below chance.
- Trusting pairs with few tickets. Cold brew with parfait has the highest lift of all, 4.79, but that's 220 tickets. Without a minimum support (at the café, 1%), that pair would top the list on very little evidence.
- Assuming cause. Cold brew and sandwich going together doesn't prove one causes the other. It could be the time of day or a sign on the counter. According to a 2024 paper on market basket analysis, the results usually fall into useful rules, trivial ones (what anyone in the business already knows) and inexplicable ones. That's why you test before you invest.
- Analyzing a short period. If your business changes with the seasons, like cold brew in summer, use 12 months or compare season against season.
Frequently asked questions
What is market basket analysis?
It's a technique that finds which products show up together on the same ticket more often than chance would explain. It uses association rules and measures them with support, confidence and lift.
What do support, confidence and lift mean?
Support is the percentage of tickets with the pair. Confidence is the percentage of tickets with A that also have B. Lift compares that confidence with how common B is overall: above 1, they're bought together more than chance.
How many tickets do I need?
There's no magic number. Set a minimum support, say 1% of tickets, and drop the pairs below it. At the café that was 360 tickets. With few tickets, use only your ten best sellers.
Can I do market basket analysis in Excel, or do I need Python?
You can do it in Excel or Google Sheets with a pivot table and COUNTIFS, as in the steps above. Python helps when you have tens of thousands of tickets or want to repeat it every month.
The five analyses in the series and when to use each
- Pareto analysis: to see which few products carry your sales. Use it first, to decide where to look.
- RFM analysis: to see which customers to keep, win back or let go.
- Cohort analysis: to see whether the customers who arrived in a given month keep coming back later.
- Break-even analysis: to find out how much you need to sell to cover your costs, before changing prices or opening something new.
- Market basket analysis: to find out what's bought together, before building bundles or moving products around the shop.
If your data isn't in one place yet, start with our business intelligence guide for small businesses.
Your next step
Export a month of tickets today, with one row per product. Take your five best sellers, build the ten possible pairs and calculate the lift of each one. That alone will show you at least one pair you didn't expect.
If you want the analysis to update itself every month and your team to get the list of bundles and placements to test, ShineTechData can build it with you. Take a look at our data analysis service.
Sources
- Persistent Cost Increases and Enduring Demand Will Shape the Restaurant Industry in 2026(opens in a new tab) — National Restaurant Association, 2026
- Specialty Coffee Consumption Remains at Record High(opens in a new tab) — National Coffee Association (2026 National Coffee Data Trends), 2026
- Market Basket Analysis Using Rule-Based Algorithms and Data Mining Techniques(opens in a new tab) — arXiv (Kholod and Mokrenko), 2024
About the author
Diogenes MonegroCEO, ShineTechData
Diogenes Monegro is the CEO of ShineTechData, a data and AI consultancy based in San Pedro de Macorís, Dominican Republic, that helps small and mid-sized businesses put their data to work.