Category: FUNCTION | Updated: 2026-11-22

How to Use the SPARKLINE Function: Create Mini Charts (Line & Bar) Inside a Cell

Overview of the SPARKLINE Function

Unlike standard inserted charts, the SPARKLINE function draws a compact chart (sparkline) that fits inside a single cell. Placing it at the right edge of a sales trend table or KPI dashboard lets you grasp trends and achievement rates at a glance.

Syntax

=SPARKLINE(data, [options])
  • data: The cell range containing the numeric values to plot (e.g., B2:G2).
  • options (optional): Settings such as chart type, color, and min/max values, specified as an array of { "option_name", value; ... }.

Practical Examples with a Table

This example displays different mini charts in column F based on monthly sales data (B2:E2).

Cell A (Branch) B (Jan) C (Feb) D (Mar) E (Apr) F (Mini Chart Formula)
1 Branch Name Jan Feb Mar Apr Formula (Chart Type)
2 Tokyo Branch 120 150 140 180 =SPARKLINE(B2:E2)
(Standard line chart)
3 Osaka Branch 90 110 130 160 =SPARKLINE(B3:E3, {"charttype", "column"; "color", "#1a73e8"})
(Blue column chart)
4 Achievement Rate 75 25 - - =SPARKLINE(B4:C4, {"charttype", "bar"; "max", 100})
(Horizontal bar chart with max 100)

Common Errors and Precautions

  • Option delimiters (semicolons and commas): In standard Google Sheets syntax, keys and values inside the options array are separated by a comma (,), while separate option pairs are separated by a semicolon (;). Using only commas will cause a formula parse error.
  • Multi-row and multi-column ranges: The data passed to SPARKLINE must generally be a one-dimensional range—either a single row or a single column. Passing a 2D table (multiple rows × multiple columns) results in an error.
  • Standardizing axis scales: When placing SPARKLINE charts row by row, each row automatically scales to its own min and max values by default. To compare heights across rows, fix "ymin" and "ymax" to the same values in every row.

Frequently Asked Questions

Q. What chart types can be created with SPARKLINE?

A. Using the charttype option, you can specify four types: "line" (line chart), "bar" (stacked horizontal bar chart), "column" (column chart), and "winloss" (win/loss chart).

Q. How do I change the color or line thickness of a SPARKLINE chart?

A. Pass key-value pairs inside curly braces {} in the second argument (options), such as {"color", "red"; "linewidth", 3}.