A Sankey diagram shows how something flows from one set of categories to another. The width of each connecting band represents the amount flowing between those categories, so the largest movements are immediately obvious.
We can create this effect in Excel using standard charts, a few calculation tables, and some careful formatting. There are no add-ins involved. The secret is that what looks like one Sankey diagram is actually several charts laid on top of one another.
There is a fair amount of setup initially, particularly when creating the charts. But once the template is built, changing the source values updates the diagram automatically.
If you want to follow the calculations in an existing workbook, download the example file. It is much easier to understand the individual parts when you can select them yourself.
What You'll Learn
- Overlay standard 100% stacked area and column charts to create a Sankey diagram without add-ins.
- Use invisible Above and Below series to position each flow band.
- Assign unique destination positions to bring each band into the correct ending category.
- Include zero-valued connections so the completed template can display them when source values change.
What the Sankey Diagram Shows
Sankey diagrams are often used to illustrate energy usage. As a finance guy, I have used cash flows instead.
On the left, we have four sources of income:
- Dave’s salary
- Julie’s salary
- Rental income
- Dividends
On the right, that money is allocated to four destinations: home, cars, food, and savings. Each band connects an income source to a destination, and its thickness shows how much money takes that route.
This gives us more information than separate income and expenditure totals. We can see the individual connections as well as the overall size of each category.
The Secret: Combine 21 Standard Excel Charts
The example uses 21 separate charts:
- Two 100% stacked column charts create the start and end pillars.
- Nineteen 100% stacked area charts create the connecting bands and the spacing elements.
There are 16 possible income-to-destination combinations, plus three blank spacing rows. Each row has its own area chart, even if it is a blank or currently has a value of zero.
To inspect the components in the example workbook, go to Home > Find & Select > Selection Pane. Expand the chart group to see the start chart, end chart, and individual area charts.
If you select one of the area charts and move it, you will find that it contains just one connecting band. Use Ctrl+Z to put it back.
Once you understand that each band is a separate chart, the calculation tables become much less mysterious. Their job is simply to position each band correctly within an otherwise transparent chart.
Set Up the Source Data and Category Gaps
The source data is a matrix, called Sankey Data in the template. Income categories run down the left, and expenditure categories run across the top.
Each intersection holds one flow value. For example, the intersection of Julie’s salary and cars contains the amount of Julie’s income allocated to cars.
Changing that value to 2,000 makes the corresponding band noticeably thicker. The rest of the calculation model then adjusts the category totals and band positions.
We also need a separate value to control the gaps between categories. In the example, this is a named range called Blank.
- A Blank value of 500 creates larger gaps.
- Reducing it to 200 brings the categories closer together.
Blank controls vertical separation, not the horizontal shape of the bands. We will use a different named range for horizontal spacing later.
Build the Three Calculation Tables
Three intermediate tables connect the source matrix to the charts:
- Sankey Start Pillar calculates the segments in the left pillar.
- Sankey End Pillar calculates the segments in the right pillar.
- Sankey Lines calculates the values and positions of all connecting bands.
The pillar tables take their totals from Sankey Lines, so it helps to understand that detailed table first.
Sankey Lines: Include Every Possible Connection
The From and To columns contain a unique list of every possible source-and-destination combination.
Start with Dave’s salary matched to home, cars, food, and savings. Add a row for Blank 1, then repeat the four destinations for Julie’s salary. Continue with Blank 2, rental income, Blank 3, and dividends.
For this four-by-four example, that produces 19 rows: 16 flows and three gaps.
There is nothing particularly clever about the From and To formulas in the template. They are simply linked to the appropriate category cells. The important thing is to include every combination and keep the rows in the order required at the start of the diagram.
Do not omit combinations that currently contain zero. Creating a row and chart for them now allows those connections to appear later when the values change.
Retrieve Each Flow Value
The Value column retrieves the appropriate number from the original matrix using INDEX with two MATCH functions. One MATCH identifies the source row, and the other identifies the destination column.
The blank rows need special treatment because Blank 1, Blank 2, and Blank 3 do not exist in the source matrix.
An IF test checks whether the first five characters in the From column are “Blank.” If they are, it returns the value from the Blank named range. Otherwise, it returns the relevant matrix value.
So every row in the Value column contains either an actual cash flow or the amount of space reserved for a category gap.
Calculate the Start and End Pillar Totals
The start pillar lists the source categories with a blank between each pair:
- Dave’s salary
- Blank 1
- Julie’s salary
- Blank 2
- Rental income
- Blank 3
- Dividends
Its Value column uses SUMIFS to total the Sankey Lines values where the From category matches the current pillar category.
The end pillar works in the same way, but its categories are home, cars, food, and savings, again separated by Blank 1, Blank 2, and Blank 3. Its SUMIFS formula matches against the To column instead.
These values will become the segments of the two 100% stacked column charts. Although Excel lets us change the series order afterward, keeping the calculation rows in the intended display order makes the workbook much easier to follow.
Assign the Correct End Position to Every Band
The Sankey Lines rows are already arranged in their starting order. Now we need to specify the order in which those same bands arrive at the right-hand pillar.
The End Position column assigns a unique number from 1 to 19 to every row. Each number is used once.
At the destination, we want all the home flows together, followed by a gap, then all the car flows, and so on. The numbering is therefore:
- Positions 1 to 4: home flows from Dave’s salary, Julie’s salary, rental income, and dividends, in that order.
- Position 5: the first blank gap.
- Positions 6 to 9: car flows from the same four sources.
- Position 10: the second blank gap.
- Positions 11 to 14: food flows.
- Position 15: the third blank gap.
- Positions 16 to 19: savings flows.
This means Dave’s salary-to-home row has an End Position of 1, while Dave’s salary-to-cars row has an End Position of 6.
The numbers can look rather random when read down a source-ordered list. They are not. They describe the destination order that the next set of calculations needs.
Calculate the Space Above and Below Each Band
Each area chart contains three series:
- Above: invisible space above the band.
- Value: the visible flow band.
- Below: invisible space below the band.
Each series has four points: Start, Mid 1, Mid 2, and End. Together, these points create a flat section at each end with a sloping section between them.
Above Start: A Running Total of Earlier Rows
Above Start is the running total of the Value column, minus the current row’s value. In other words, it is the total of everything that comes before the current band.
The template creates the running total with a SUM range that begins at the Value column header and ends at the current row. Subtracting the current value leaves only the preceding rows.
For the first row, Above Start is zero because nothing comes before it.
Above End: A Total Based on Destination Order
Above End calculates how much space is needed before the band at its destination.
It takes the total of the entire Value column and subtracts all values whose End Position is greater than or equal to the current row’s End Position.
That leaves the sum of all rows with an earlier destination position. For End Position 1, the result is zero. For End Position 6, it includes the four home flows and the first blank gap.
Use the Midpoints to Create the Slope
The two middle Above columns are straightforward:
- Above Mid 1 equals Above Start.
- Above Mid 2 equals Above End.
This holds the band at its starting height for the first section, moves it to its ending height through the middle, and holds it there for the final section.
Area charts do not provide the curved connectors we might ideally use for a Sankey diagram. These intermediate points let us create the angled version using standard Excel charts.
Keep the Flow Value Constant
The four Value columns all equal the row’s original Value. We are changing where the band sits, not how much it represents as it moves across the chart.
That constant value is what preserves the flow amount from source to destination.
Fill the Remaining Space Below
For each of the four points, the Below calculation is:
Below = total of the Value column minus the corresponding Above amount minus the corresponding flow Value.
For example, Below Start uses Above Start and Value Start. Below Mid 1 uses Above Mid 1 and Value Mid 1, and the same pattern continues through to End.
At every point, Above, Value, and Below add up to the same total. That common total keeps all the 100% stacked charts on a consistent proportional scale.
Control Where the Bands Begin to Slope
A named range called Spacing supplies the four horizontal positions for Start, Mid 1, Mid 2, and End.
These positions control the length of the flat sections and where the angled section begins and ends.
For example, changing the first intermediate spacing value from 10 to 50 creates a longer flat run-in before the band slopes. Changing it back to 10 restores the shorter run-in.
Remember the distinction:
- Blank controls the vertical gaps between categories.
- Spacing controls the horizontal positions of the band’s four points.
Create One Sankey Band with a Stacked Area Chart
Now for the repetitive part: creating the charts. The same process is required for every row in Sankey Lines.
Rental income flowing to savings is a useful first example because it has nonzero space above and below the visible band.
- Select a blank cell.
- Go to Insert and insert a 100% Stacked Area chart.
- Right-click the blank chart and choose Select Data.
- Add the first series using the row’s four Above columns.
- Add the second series using its four Value columns.
- Add the third series using its four Below columns.
- Edit the Horizontal Category Axis Labels and select the four cells in the Spacing named range.
- Confirm the selections.
Starting with a blank chart is easier than selecting the whole calculation table first, as Excel would otherwise add elements we would only need to remove.
Format the Chart to Leave Only the Band
The chart needs to become almost completely transparent:
- Delete the chart title.
- Format the horizontal axis as a Date axis, then delete the axis.
- Format the vertical axis to display Values in reverse order, then delete it.
- Set the Above series to No Fill.
- Set the Below series to No Fill.
- Give the Value series a solid gray fill with 50% transparency and no line.
- Delete the major gridlines.
- Set both the Chart Area and Plot Area to No Fill.
If the area series makes the gridlines difficult to select, use the chart element selector on the Format tab to select the major gridlines, then press Delete.
For a blank spacing row, make the Value series fully transparent as well. It still contributes to the positioning calculations, but it must not appear as a visible flow.
Repeat this setup for every row in Sankey Lines. Overlay the charts with matching dimensions and aligned plot areas so that the individual bands form one diagram.
Add the Start and End Pillars
Create the two pillars as 100% stacked column charts, using the start and end pillar calculation tables.
The category values create the colored segments, while the blank series provide the gaps between them. Keep those blank segments invisible.
Reverse the pillar value axes so that the first category appears at the top rather than at the bottom. In the example, Dave’s salary should be the top segment of the start pillar.
Add data labels to the segments that need them, and position the pillars against the corresponding ends of the connecting bands.
Using 100% stacked charts for both the pillars and the bands is important. Because they share the same underlying totals, changes to the source numbers keep their proportions in sync.
Test and Reuse the Sankey Template
Once everything is aligned, test the diagram by changing values in the source matrix.
Increase an existing flow and check that its band thickens while the pillar segments adjust. Then change a zero-valued connection to a positive number. Because every possible connection already has a calculation row and chart, the new flow should appear without rebuilding the diagram.
This is where the initial work pays off. More connections mean more calculation rows and more charts to create, but routine value changes within the completed structure are handled by the template.
The result comes from reasonably simple Excel components: tables, SUMIFS, lookup formulas, stacked column charts, and stacked area charts. Put them together in the right way, and they create a useful, updateable Sankey diagram without an add-in.


