Stacked Sparklines
Stacked sparklines are small charts that show how multiple data series contribute to a total. Each segment represents a part of the total for a given point, making it easy to visualize both overall trends and individual contributions. The stacking effect helps compare proportions and totals across time or categories.
When to use stacked sparklines
- Showing cumulative data: Visualize how different sources—such as revenue streams or product categories—build up to a total.
- Comparing proportions: Show how each segment contributes to the whole across points in time or grouped categories.
- Breaking down overall trends: Present both total values and their individual components in one compact view.
Create a stacked sparkline
- On the Insert tab, select Sparklines.
- Under Bar Sparkline, select Insert Stacked Sparkline. The Create Sparklines dialog opens.
- In Data Range, select a continuous range of cells (in the same row or column).
- In Location Range, select the cell where the sparkline will appear.
- Click Ok. The sparkline is inserted into the selected cell.
Edit a stacked sparkline
- Select the stacked sparkline in your workbook.
- On the Sparkline tab, select Settings. The StackedSparkline Setting dialog opens.
- Set the parameters, then click Ok.
- Copy and paste the sparkline cell to duplicate the configuration in another location, as needed.
Stacked sparkline parameters
The stacked sparkline formula supports the following format:
=STACKEDSPARKLINE(points, colorRange?, labelRange?, maximum?, targetRed?, targetGreen?, targetBlue?, targetYellow?, color?, highlightPosition?, vertical?, textOrientation?, textSize?)
| Parameter | Description |
|---|---|
| Points | Defines the range of cells containing values, such as A1:A4. Invalid or empty values are treated as 0. |
| ColorRange | (Optional) Sets a cell range containing colors for each segment, such as B1:B4. If omitted, colors are generated from the base color. |
| LabelRange | (Optional) Sets a cell range containing text labels for each segment, such as C1:C4. If omitted, no labels are shown. |
| Maximum | (Optional) Sets the maximum value for the sparkline. If omitted, the sum of all positive values is used. |
| TargetRed | (Optional) Sets the position of a red reference line. |
| TargetGreen | (Optional) Sets the position of a green reference line. |
| TargetBlue | (Optional) Sets the position of a blue reference line. |
| TargetYellow | (Optional) Sets the position of a yellow reference line. |
| Color | Sets a base color for generating segment colors when ColorRange is not defined. Default is #646464. |
| HighlightPosition | (Optional) Sets the index of the segment to highlight. |
| TextOrientation | Sets label orientation: Horizontal (default) or Vertical. |
| TextSize | (Optional) Sets the font size (in pixels) for labels. Default is 10. |
| Vertical | (Optional) Display the sparkline vertically when selected. |