Skip to main content

Hbar Sparklines

To create horizontal bar sparklines in the workbook:

  1. Click Insert from the menu.

  2. Click Sparkline and select the hbar sparkline under Bar Sparkline from the list.

  3. In the HbarSparkline Setting dialog box:

    1. Enter the number or reference that represents the length of the bar, such as 0.3 or "A1".

    2. Select the color scheme. The default value is "gray".

    3. Click OK.

  4. The sparkline is displayed in the cell. Click the function to edit the sparkline parameters.

  5. Set the parameters as described below and click OK.

  6. Copy and paste the cell as needed to finalize your hbar sparklines.

Hbar Sparkline ParameterDescription
Value

Number or reference that represents the length of the bar, such as 0.3 or "A1".

  • If the value is greater than 100% or smaller than -100%, an arrow is displayed.

  • For positive values, the sparkline starts at the left of the cell; for negative values, the sparkline starts at the right of the cell.

colorSchemeString that represents the color of the bar; the default value is "gray".
axisVisible(Optional) Boolean that represents whether to show the axis; the default value is true.
barHeight(Optional) Number that represents the percentage of bar height according to the cell height (value greater than 0 and value less than or equal to 1).
LET function

(Optional) You can add a LET function to set colors according to specific values with IF statements.

For example:

=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))

The hbar sparkline formula has the following format:

=HBARSPARKLINE(value, colorScheme, axisVisible, barHeight)