Why last click hands the credit to the wrong channel
You run marketing or analytics for an online shop. Every month someone asks the same question: which channel actually brings in the orders? The default report in most tools answers with last-click attribution. Whatever the customer touched just before buying gets 100% of the order. It is easy to explain, and for many shops it is badly misleading.
Think about how people really buy home goods. Someone sees a cushion on Instagram, forgets about it, searches for the shop a few days later, signs up for the newsletter, and finally buys from an email. Last click gives the whole order to Email. Social, which created the interest in the first place, gets nothing. Cut the social budget on that basis and a few months later the email list stops growing and search volume drops. Nobody can say why, because the report never showed the dependency.
Markov chain attribution is a data-driven way to share the credit along the whole path. It treats every customer journey as a walk through a set of states, measures how likely each step is, and then asks a simple question for each channel: if this channel disappeared, how many conversions would we lose? That question, the removal effect, is what the later lessons of this course calculate. Everything starts with one practical step, and that step is this free lesson: turning a list of journeys into a transition count table.
This article is for marketing analysts, e-commerce managers, performance marketers and students who know basic Excel (SUM, cell references) and want to understand attribution properly instead of trusting a black-box setting in an ad platform. You will work with Fernhill Home, a fictional online home-goods store, and 14 journey paths that stand for 2,460 visitors and 270 orders in one month. All numbers are illustrative teaching data.
The core idea: states, steps and two possible endings
A Markov chain is a model of something that moves from state to state, where the next step depends only on where you are now. For attribution, the states are:
- Start: an artificial state every journey begins in. It lets you count which channel people meet first.
- The channels: here Search, Social, Email and Display. A visitor can pass through one, two or three of them.
- Conversion: the journey ended with an order. Once you are here you stay here, which is why it is called an absorbing state.
- Null: the journey ended without an order. Also absorbing.
A journey such as Social → Search → order becomes the walk Start → Social → Search → Conversion. The model does not care about the order of the whole sequence or about time between touches. It only cares about single steps: how often does a visitor go from Start to Social, from Social to Search, from Search to Conversion? Count those steps across all journeys and you have everything the chain needs.
The diagram below shows one path from the lab, P05. It stands for 260 visitors who first came through Social and then through Search. 39 of them bought, 221 did not. Every arrow adds the 260 journeys (or the 39 and 221 at the end) to one cell of the count table.
Why count steps instead of whole paths? Because steps can be recombined. A three-touch path shares its Social → Search step with a two-touch path. Once you have the step counts, you can turn them into probabilities (lesson 2), follow every possible walk at once with matrix multiplication (lesson 3) and simulate what happens when a channel is removed (lesson 4). None of that works on a list of whole paths.
Worked example: Fernhill Home's 14 journey paths
The analytics export has been grouped into unique paths. Each row is one exact sequence of touches, with the number of visitors who followed it (Journeys) and how many of them placed an order (Conversions). The last column, Last touch, is the first thing you calculate in the lab.
| Path | Touch 1 | Touch 2 | Touch 3 | Touches | Journeys | Conversions | Last touch |
|---|---|---|---|---|---|---|---|
| P01 | Search | 1 | 420 | 46 | Search | ||
| P02 | Social | 1 | 380 | 9 | Social | ||
| P03 | 1 | 150 | 21 | ||||
| P04 | Display | 1 | 310 | 4 | Display | ||
| P05 | Social | Search | 2 | 260 | 39 | Search | |
| P06 | Display | Search | 2 | 180 | 22 | Search | |
| P07 | Search | 2 | 140 | 27 | |||
| P08 | Social | 2 | 90 | 14 | |||
| P09 | Display | Social | 2 | 120 | 6 | Social | |
| P10 | Search | 2 | 70 | 12 | Search | ||
| P11 | Social | Search | 3 | 110 | 26 | ||
| P12 | Display | Social | Search | 3 | 95 | 17 | Search |
| P13 | Search | Social | 3 | 60 | 9 | ||
| P14 | Display | Search | 3 | 75 | 18 |
Column H uses =INDEX(B2:D2,E2). INDEX picks the cell in position E2 of the range B2:D2, so a one-touch path returns touch 1, a two-touch path touch 2, and a three-touch path touch 3. It is shorter and safer than nested IFs such as =IF(E2=1,B2,IF(E2=2,C2,D2)), and it never returns an empty Touch 3 by mistake.
Now build the count table below the paths. Rows are the "from" states (Start and the four channels), columns are the "to" states (the four channels, Conversion and Null). This is the finished table you will reach in the lab:
| From \ To | Search | Social | Display | Conversion | Null | Total | |
|---|---|---|---|---|---|---|---|
| Start | 620 | 840 | 220 | 780 | 0 | 0 | 2,460 |
| Search | 0 | 60 | 325 | 0 | 136 | 889 | 1,410 |
| Social | 465 | 0 | 150 | 0 | 15 | 485 | 1,115 |
| 70 | 0 | 0 | 0 | 115 | 510 | 695 | |
| Display | 255 | 215 | 0 | 0 | 4 | 306 | 780 |
Here is how each block is filled, with the exact formulas from the lab sheet (paths in rows 2–15, the table header in row 17, row labels in column A).
- Start row (B18:E18): journeys whose touch 1 is the channel.
=SUMIF($B$2:$B$15,B$17,$F$2:$F$15)in B18, filled right. Start → Social is 840 = 380 + 260 + 90 + 110 (paths P02, P05, P08 and P11). Start never goes straight to Conversion or Null, so F18 and G18 stay 0. - Channel → channel (B19:E22): a step can happen between touch 1 and 2 or between touch 2 and 3, so add two SUMIFS:
=SUMIFS($F$2:$F$15,$B$2:$B$15,$A19,$C$2:$C$15,B$17)+SUMIFS($F$2:$F$15,$C$2:$C$15,$A19,$D$2:$D$15,B$17). Search → Email is 325 = 140 (P07, step 1→2) + 110 (P11, step 2→3) + 75 (P14, step 2→3). - Conversion column (F19:F22): conversions of the paths whose last touch is the channel:
=SUMIFS($G$2:$G$15,$H$2:$H$15,$A19). Email → Conversion is 21 + 14 + 26 + 9 + 18 + 27 = 115. - Null column (G19:G22): the journeys that ended at that channel without an order:
=SUMIFS($F$2:$F$15,$H$2:$H$15,$A19)-F19. Email → Null is 510. - Totals (H18:H22):
=SUM(B18:G18)and copied down.
Notice the mixed references. $A19 locks the column of the "from" label but lets the row move when you copy down. B$17 locks the row of the "to" label but lets the column move when you copy right. One formula, written once, fills the whole 4 × 4 block. Getting the dollar signs right is the most useful Excel habit in this entire course.
What the counts already tell you
Even before any probabilities, the table changes the conversation. Look at Social. It is the most common first touch: 840 of 2,460 journeys start there. Yet only 15 orders have Social as their last touch. Under last click, Social looks almost useless. Under the counts, Social sends 465 journeys on to Search and 150 to Email, the two channels that collect most of the last-click credit.
Display tells a similar story: 780 journeys start there, but it is never reached from another channel, so its row total is also 780, and only 4 orders end on it. Email is the opposite: few people start with Email (220), but many arrive from Search and Social, and it closes 115 orders. The count table already shows the roles: Social and Display open journeys, Search carries them, Email closes them.
Lessons 2 to 5 turn this into numbers you can defend. For orientation, here is where the full course ends up for these same 270 orders. Last click credits Search with 136 orders and Social with 15. The Markov chain built from your count table credits Search with about 108 and Social with about 60, roughly four times as much. Display goes from 4 to about 34.
How to build the transition count table in Excel, step by step
Open the lab above (or your own export laid out the same way) and follow these steps. Shortcuts are for Windows. On a Mac use Cmd instead of Ctrl, and Fn+F4 or Cmd+T for the reference toggle.
- Lay out the paths. One row per unique path, one column per touch position, then Touches, Journeys and Conversions. If your tool exports one row per visitor, group first with Insert → PivotTable, putting the path in Rows and a count of visitors in Values.
- Add the last touch. In H2 type
=INDEX(B2:D2,E2), press Enter, select H2:H15 and press Ctrl+D to fill down. - Write the table headers. In row 17 put From \ To, the four channels, Conversion, Null and Total. In A18:A22 put Start and the four channels. Spell them exactly as in the path columns, because SUMIF matches text exactly (case is ignored, spaces are not).
- Fill the Start row. In B18 type
=SUMIF($B$2:$B$15,B$17,$F$2:$F$15). Use F4 while the cursor is inside each reference to add the dollar signs. Select B18:E18 and press Ctrl+R. - Fill the channel block. In B19 enter the double SUMIFS formula from the worked example. Select B19:E22, then press Ctrl+D and Ctrl+R. You can also find SUMIFS under Formulas → Math & Trig and fill in the dialog box if you prefer.
- Fill Conversion and Null. F19:
=SUMIFS($G$2:$G$15,$H$2:$H$15,$A19). G19:=SUMIFS($F$2:$F$15,$H$2:$H$15,$A19)-F19. Fill both down to row 22. - Add totals. Select B18:H22 and press Alt+= (AutoSum), or type
=SUM(B18:G18)in H18 and fill down. - Audit. Press Ctrl+` to show all formulas and check that every reference moves the way it should. Then check the totals against 2,460 journeys and 270 orders. A colour scale (Home → Conditional Formatting → Color Scales) on B18:G22 makes the big flows easy to see.

Common mistakes and how to spot them
Most errors in this step are silent: the table fills with plausible numbers that are simply wrong. These are the ones that come up again and again.
- Counting paths instead of journeys.
=COUNTIF(B2:B15,"Social")returns 4 (four paths start with Social), not 840 journeys. Spot it: your Start total is 14 instead of 2,460. - Only counting the first step. One SUMIFS for touch 1 → touch 2 misses every touch 2 → touch 3 step. Spot it: a channel's row total is smaller than the journeys passing through it. Search → Email shows 140 instead of 325.
- Using the first touch for the ending. If the Conversion column is filled from touch 1, the conversions of multi-touch paths land on the wrong channel. Spot it: Social suddenly has a large Conversion count.
- Forgetting Null. Without the Null column, every row seems to lead only to channels and conversions, and the probabilities in lesson 2 will be far too high. Spot it: the row total of Display is 4 instead of 780.
- Wrong dollar signs.
$A$19instead of$A19makes every row look up Search. Spot it: four identical rows. - Inconsistent channel names. "Paid Search" in one place and "Search" in another, or a trailing space. SUMIF will silently return 0. Spot it: a cell that should clearly have traffic shows 0. Clean the labels with
=TRIM()or Find & Replace (Ctrl+H). - Self-loops ignored by accident. Real exports often contain Search → Search (two paid clicks in a row). Decide on purpose whether to keep or merge repeated touches. Merging is common. Either way, write the rule down.
Quick reference: functions and shortcuts used in this lesson
| Function / shortcut | What it does here | Example |
|---|---|---|
| INDEX | Returns the n-th cell of a range: the last touch of a path | =INDEX(B2:D2,E2) |
| SUMIF | Adds journeys of rows that match one condition | =SUMIF($B$2:$B$15,B$17,$F$2:$F$15) |
| SUMIFS | Adds journeys that match two or more conditions (one step from → to) | =SUMIFS($F$2:$F$15,$B$2:$B$15,$A19,$C$2:$C$15,B$17) |
| SUMPRODUCT | Multiplies arrays of TRUE/FALSE tests with numbers and adds the result | =SUMPRODUCT(($H$2:$H$15=$A19)*$G$2:$G$15) |
| COUNTIF | Counts rows (paths), not journeys: useful for a sanity check only | =COUNTIF(B2:B15,"Search") |
| SUM | Row and column totals for the checks | =SUM(B18:G18) |
| F4 | Cycles a reference through $A$1, A$1, $A1 and A1 | Press while the cursor is in a reference |
| Ctrl+D / Ctrl+R | Fill down / fill right from the first cell of a selection | Select B18:E18, press Ctrl+R |
| Ctrl+` | Shows formulas instead of results, to audit a whole block | Toggle on and off |
Real-world uses of a transition count table
The count table is useful well beyond the final attribution model. Some typical situations:
- Budget review. A shop is about to cut a prospecting channel that looks weak under last click. The Start row and the channel → channel block show how many journeys it feeds into the closing channels, which is the evidence needed before cutting.
- Email and CRM planning. A high Search → Email count tells you that many visitors find you through search and then sign up. That is a reason to improve the sign-up on search landing pages.
- Agency reporting. An agency that runs Social for a client can show the client the journeys Social started, instead of arguing about last-click numbers.
- Data quality checks. A sudden jump in Start → Null for one channel often means broken tracking or a landing page error, long before revenue reports show it.
- Teaching and stakeholder buy-in. A count table is something non-analysts can read. It is a good way to explain why the team is moving away from last click before showing any matrix algebra.
What you will build in the rest of this course
This free lesson builds the foundation. The paid course ($9.90, one-time) takes the same Fernhill Home data all the way to channel credit, budget decisions and an honest view of the uncertainty. Each lesson has its own lab sheet with the Coach checking your formulas.
The Transition Probability Matrix: Rows that Sum to 1, Absorbing States and Two-Step Paths. You divide each count by its row total to get the transition probability matrix, add the absorbing Conversion and Null rows, and use MMULT to see where a visitor is likely to be two and three steps later.
Conversion Probability from Start: Step-by-Step Convergence and the Exact (I − Q)⁻¹ Solution. You follow a visitor from Start through ten steps, watch the conversion probability settle, and then solve it exactly with the fundamental matrix (I − Q)⁻¹ using MINVERSE, and compare the result with the observed conversion rate.
Removal Effects: What Happens to Conversions when a Channel Disappears. The heart of the method: you remove one channel at a time, recalculate the chance of converting, and turn the drop into a removal effect for every channel with a single masked MINVERSE formula.
Attribution Shares: Normalising Removal Effects into Credited Conversions and Revenue. Removal effects add up to more than 100%, so you normalise them into shares and turn them into credited orders and revenue that add up exactly to what the shop sold.
Markov vs Last Click vs Linear: Who Gains, Who Loses (with a Chart). You calculate last-click and linear credit from the same journeys, set them next to Markov, find the channel last click undervalues most, and build a comparison chart for your report.
Budget Implications: Cost per Attributed Conversion, ROAS and a Naive Reallocation. You put a price on the results: cost per attributed conversion and ROAS per channel under both models, and a naive budget reallocation by Markov credit, with a clear discussion of why that is a starting point and not a plan.
Sensitivity & Limitations: How Stable Is the Credit, and What Markov Attribution Cannot Tell You. You run the model on three months, measure how much each channel's share moves with the coefficient of variation, flag unstable credit and learn what Markov attribution cannot tell you, such as true incrementality.
Summary
Markov chain attribution starts with a simple, very practical step: break every journey into single steps and count them, weighted by the number of visitors on each path. INDEX finds the last touch, SUMIF fills the Start row, a pair of SUMIFS fills the channel → channel block, and SUMIFS on the last touch fills Conversion and Null. Two totals, 2,460 journeys and 270 orders, prove the table is right.
Even this first table shows things last click hides: Social and Display open most journeys, Search carries them, and Email closes them. Try it now in the lab above. Fill the last touch column, build the Start row and the channel block, and let the Coach check your cells. When the totals match, you are ready to turn counts into probabilities.
Frequently asked questions
What is Markov chain attribution?
It is a data-driven attribution model that treats customer journeys as walks between states (channels, conversion and no conversion). Each channel is credited by its removal effect: how many conversions would be lost if the channel were taken out of the journeys.
Can I do Markov chain attribution in Excel?
Yes. With a manageable number of channels you can count transitions with SUMIF and SUMIFS, build the probability matrix by dividing by row totals, and solve the chain with MMULT and MINVERSE. This course does every step in Excel.
What is a transition matrix in marketing attribution?
It is a table with one row per "from" state and one column per "to" state. The counts version shows how many journeys made each step, and the probability version divides each row by its total so that every row sums to 1.
What does the Null state mean?
Null is the ending for journeys that did not convert. Without it the model would assume every journey eventually converts, and the conversion probabilities would be far too high.
How is Markov attribution different from last-click attribution?
Last click gives each order entirely to the final touch. Markov attribution looks at the whole path and shares the credit according to how much each channel contributes to reaching conversion, so channels that start or carry journeys get credit too.
How much data do I need for a Markov attribution model?
There is no fixed number, but every transition you rely on should be based on enough journeys that it does not jump around from month to month. Grouping rare channels and checking stability over several periods, as in lab 8 of this course, is a sensible approach.
Keep going: Markov Chain Attribution: Channel Paths, Removal Effects & Fair Credit
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.
- The Transition Probability Matrix: Rows that Sum to 1, Absorbing States and Two-Step Paths
- Conversion Probability from Start: Step-by-Step Convergence and the Exact (I − Q)⁻¹ Solution
- Removal Effects: What Happens to Conversions when a Channel Disappears
- Attribution Shares: Normalising Removal Effects into Credited Conversions and Revenue
- Markov vs Last Click vs Linear: Who Gains, Who Loses (with a Chart)
- Budget Implications: Cost per Attributed Conversion, ROAS and a Naive Reallocation
- Sensitivity & Limitations: How Stable Is the Credit, and What Markov Attribution Cannot Tell You
- The Fundamental Matrix: Expected Visits per Channel, Path Length and the Null Probability
- Conversion Odds from Every Channel: Absorption Probabilities N × R, Lift and Direct Closing
- Revenue, Not Just Orders: Two Basket Sizes as Absorbing States and Revenue Removal Effects
- Partial Cuts: What 25%, 50% and 75% Less of a Channel Does to Conversions (Response Curves)
- Testing the Memoryless Assumption: Does the Touch Before Search Change Its Conversion Rate?
- First Click, Position-Based and Time Decay: Three More Rule-Based Models Next to Markov
- Shapley Values for Channels: Coalition Orders, Fair Weights and a Second Opinion on Markov Credit
- How Sure Are the Probabilities? Standard Errors, 95% Intervals and the Visits a Channel Needs
- A Second Store with Five Channels: Brookvale Outdoor from Counts to Credited Orders
- Calibrating Markov Credit with Holdout Tests: Incremental Orders, Calibration Factors and True CPA
- Lookback Windows: How a 7-Day or 30-Day Window Changes the Paths and the Credit
- Final Project: December Attribution Dashboard for Fernhill Home (Credit, Revenue, ROAS and Flags)