Skip to main content

Horizontal Bar Sparklines

Horizontal bar sparklines, also called hbar sparklines, are small bar charts that display data as horizontal bars. They are used to compare values across categories in a compact, space-efficient format.

When to use horizontal bar sparklines

  • Comparing multiple categories: Compare values such as sales, expenses, or performance across categories or time periods.
  • Tracking trends or rankings: Show which categories are performing well and which are underperforming along a horizontal axis.
  • Spotting variations: Make it easier to detect patterns, fluctuations, or outliers in category-based data.

Create a horizontal bar sparkline

  1. On the Insert tab, select Sparklines.
  2. Under Bar Sparkline, select Insert Hbar Sparkline. The HbarSparkline Setting dialog opens.
  3. Enter a number or reference that defines the length of the bar, such as 0.3 or A1.
  4. Select the color scheme. The default is gray.
  5. Click Ok. The sparkline is inserted into the selected cell.

Edit a horizontal bar sparkline

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

Horizontal bar sparkline parameters

The horizontal bar sparkline formula supports the following format:
=HBARSPARKLINE(value, colorScheme, axisVisible, barHeight)

ParameterDescription
ValueSpecifies the length of the bar, such as 0.3 or A1.

  • Values above 100% or below -100% display an arrow.
  • Positive values start from the left side of the cell; negative values start from the right.
ColorSchemeSets the color of the bar. Default is gray.
axisVisible(Optional) Boolean that represents whether to show the axis; the default value is true.
barHeight(Optional) Sets the bar height as a percentage of the cell height (greater than 0 and less than or equal to 1).
LET function(Optional) Allows you to define bar color based on value using the LET function with IF conditions.

Example – Bar color based on performance
To change the bar color based on performance, do the following:
=LET(ref,B7,color,IF(ref>=0.8,"#092834",IF(ref>=0.6,"#347B98",IF(ref>0.4,"#66B032",IF(ref>=0.2,"#B2D732",IF(ref>=0,"#F0F7D4","red"))))),HBARSPARKLINE(ref,color))