Skip to main content

Histogram Sparklines

Histogram sparklines display the frequency distribution of a dataset using vertical bars. They are useful for visualizing how values are grouped within defined intervals.

When to use histogram sparklines

  • Visualizing data distribution: Show how values are grouped across ranges, such as the frequency of items in age bands or revenue intervals.
  • Spotting patterns or outliers: Identify clusters and outliers in the data without building a full chart.
  • Quick comparison of distributions: Compare how multiple datasets are distributed in a compact format.

Key visual elements

ElementDescription
BinGroups values into defined ranges based on the histogram type (continuous or discrete).
BarVisually represents a bin. The height is calculated as:

  • cellRowHeight - labelFontSize - 6px if PaintLabel is selected.
  • cellRowHeight - 6px if not.
EdgeDraws the border around each bar. If the calculated font size exceeds the available height, it is rounded down to the largest integer that fits. If the cell is too short, the font size defaults to 12px.
Data LabelDisplays the value range inside each bar. The label font size is based on Math.floor(cellRowHeight / 3). It follows the same rounding and fallback logic as the bar edge.

Create histogram sparklines

  1. On the Insert tab, select Sparklines.
  2. Under Bar Sparkline, select Insert Histogram Sparkline. The Create Sparklines dialog opens.
  3. In Data Range, select a continuous range of cells (in the same row or column).
  4. In Location Range, select the cell where the sparkline will appear.
  5. Click Ok. The sparkline is inserted into the selected cell.

Edit histogram sparklines

  1. Select the histogram sparkline in your workbook.
  2. On the Sparkline tab, select Settings. The HistogramSparkline Setting dialog opens.
  3. Adjust the parameters, then click Ok.
  4. Copy and paste the sparkline cell to duplicate the configuration in another location, as needed.

Histogram sparkline parameters

The histogram sparkline formula supports the following format:
=HISTOGRAMSPARKLINE(dataRange,continuous?,paintLabel?,scale?,barWidth?,barColor?,labelFontStyle?,labelColor,edgeColor?)

ParameterDescription
Data RangeDefines the data source as a cell range or array, such as A1:C6 or {1, 2, 2, 3, 3}. Non-numeric values are ignored.
Continuous(Optional) Determines the histogram type.

  • When selected, it creates a continuous histogram by grouping values into intervals. The first bin is left-closed and right-closed; all other bins are left-open and right-closed.
  • When cleared, it creates a discrete histogram that uses each unique value as its own bin, such as 20, 34, or 38. Bars are sorted in ascending order.
PaintLabel(Optional) Shows or hides the data label inside each bar.
ScaleSets the bin width for continuous histograms. Must be greater than 0.
BarWidthSets the bar width as a percentage of the average bar width. Enter a value between 1% and 100%.
BarColorSets the fill color of the bars.
EdgeColorSets the color of the bar borders.
LabelFontStyleDefines the font style for data labels. Accepts custom values for font family, size, weight, and style.