What SPARKLINE Does
The SPARKLINE function renders a tiny chart inside a single cell, giving you a visual summary of data without creating a full chart object. It supports line charts, bar charts, column charts, and win/loss charts. Sparklines are perfect for dashboards, summary tables, and reports where you want to show trends at a glance without taking up extra space.
Syntax
=SPARKLINE(data, [options])
| Parameter | Description |
|---|---|
| data | A range or array of numeric values to visualize. |
| options | Optional. A set of key-value pairs enclosed in curly braces that control chart type and appearance. |
Key options
| Option | Values | Description |
|---|---|---|
"charttype" | "line", "bar", "column", "winloss" | The type of sparkline. Default is "line". |
"color" | Color name or hex code | Line or bar color. |
"linewidth" | Number | Thickness of the line (line chart only). |
"max" / "min" | Number | Fixed axis bounds. |
"highcolor" | Color name or hex | Color for the highest point. |
"lowcolor" | Color name or hex | Color for the lowest point. |
"empty" | "zero" or "ignore" | How to handle empty cells. |
Basic Examples
Simple line sparkline
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Jan | Feb | Mar | Apr | May | Trend |
| 2 | 120 | 135 | 128 | 150 | 162 | =SPARKLINE(A2:E2) |
Cell F2 displays a small line chart showing the upward trend across five months. No configuration needed — the default line chart works out of the box.
Bar chart showing progress
To display a single value as a progress bar (e.g., 75% completion):
=SPARKLINE({0.75}, {"charttype","bar"; "max",1; "color","#4285F4"})
Result: A horizontal blue bar filling 75% of the cell. This is commonly used for project trackers and KPI dashboards.
Column chart for monthly values
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Q1 | Q2 | Q3 | Q4 |
| 2 | 8500 | 9200 | 7800 | 10400 |
=SPARKLINE(A2:D2, {"charttype","column"; "color","#34A853"})
This renders four green vertical bars in the cell, one per quarter. The tallest bar corresponds to Q4 (10,400).
Advanced Examples
Win/loss chart for game results
Suppose you track wins (1) and losses (-1) across a season:
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | 1 | -1 | 1 | 1 | -1 | -1 | 1 |
=SPARKLINE(A1:G1, {"charttype","winloss"; "color","#34A853"; "negcolor","#EA4335"})
Wins appear as green bars above the baseline, losses as red bars below. This gives an instant visual read on streaks and overall performance.
Line sparkline with highlighted extremes
=SPARKLINE(B2:M2, {"linewidth",2; "color","#4285F4"; "highcolor","#34A853"; "lowcolor","#EA4335"})
This draws a blue line across 12 months of data. The highest point is marked in green and the lowest in red, making it easy to spot peak and trough months at a glance. The linewidth of 2 makes the line slightly thicker and easier to read.
Common Mistakes
- Passing non-numeric data into the data range. SPARKLINE only works with numbers. If your range includes text headers or blank cells interpreted as text, the chart will not render correctly. Make sure the data range contains only numeric values.
- Forgetting the semicolons in the options array. Options are structured as
{"key","value"; "key2","value2"}with semicolons separating pairs and commas separating keys from values. Using commas everywhere or forgetting the semicolons will cause a parse error. - Expecting sparklines to resize automatically. The chart fills whatever cell it is in. If the row is too short, the sparkline looks squished. Increase the row height or column width to give the sparkline more room to render clearly.
SheetAI Tip
Don't want to memorize this syntax? With SheetAI, just type what you need in plain English and the formula is generated for you. Install SheetAI to try it free.