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
- On the Insert tab, select Sparklines.
- Under Bar Sparkline, select Insert Hbar Sparkline. The HbarSparkline Setting dialog opens.
- Enter a number or reference that defines the length of the bar, such as
0.3orA1. - Select the color scheme. The default is gray.
- Click Ok. The sparkline is inserted into the selected cell.
Edit a horizontal bar sparkline
- Select the horizontal bar sparkline in your workbook.
- On the Sparkline tab, select Settings. The HbarSparkline Setting dialog opens.
- Set the parameters, then click Ok.
- 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)
| Parameter | Description |
|---|---|
| Value | Specifies the length of the bar, such as 0.3 or A1.
|
| ColorScheme | Sets 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))