SPARKLINE Function in Google Sheets: Formula, Examples & Troubleshooting
Build in-cell charts with SPARKLINE in Google Sheets. Use shared scales, explicit blank handling, progress bars, and chart-type-specific options.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: =SPARKLINE(B2:F2) creates a miniature line chart inside one cell. Add an options array or a two-column options range to choose a different chart type or set its scale.
Verification: NOT_TESTED_IN_GOOGLE_SHEETS. Google documentation was reviewed October 17, 2026. The numerical checks and expected chart patterns below were derived independently. No screenshot or rendered chart is presented as native output.
Syntax and chart types
=SPARKLINE(data, [options])
data is the range or array to plot. The optional options argument pairs setting names with values. An options range must be two columns wide. In an inline array, each row holds one option/value pair.
The documented chart types are line (the default), bar (stacked bar), column, and winloss (positive/negative outcomes). Do not apply a setting from one chart family indiscriminately to another. Google SPARKLINE reference.
Example: compare two weekly series fairly
Enter this data in A1:F3:
| Team | Week 1 | Week 2 | Week 3 | Week 4 | Week 5 |
|---|---|---|---|---|---|
| North | 20 | 35 | 30 | 45 | 50 |
| South | 42 | 43 | 42 | 44 | 45 |
Put Trend in G1. In G2, enter:
=SPARKLINE(B2:F2,{"charttype","line";"ymin",0;"ymax",60;"color","blue";"linewidth",2})
Fill the formula into G3 so the data reference changes to B3:F3 while both charts keep the same explicit vertical limits.
The expected North pattern rises from 20 to 35, dips to 30, and then rises to 45 and 50. South stays within 42 to 45. North’s range is 30 units; South’s is 3. With a common 0-to-60 scale, that difference remains meaningful across the two miniature charts. The endpoint changes are +30 and +3 respectively.
The chart communicates shape, not every exact value. Keep the original numbers or an adjacent summary available for readers who need precise amounts. A cell-sized chart is also easy to overinterpret if each row uses a different scale.
Use a settings range instead of an inline array
For a reusable line-chart configuration, enter:
| Cell | Option | Adjacent value cell | Value |
|---|---|---|---|
| J2 | charttype | K2 | line |
| J3 | ymin | K3 | 0 |
| J4 | ymax | K4 | 60 |
| J5 | empty | K5 | ignore |
| J6 | nan | K6 | ignore |
Then use =SPARKLINE(B2:F2,$J$2:$K$6). The absolute settings range is shared when copied down. This layout also avoids a long inline array when a spreadsheet’s locale uses different array separators.
Choose missing-data treatment deliberately. An unrecorded measurement and a measured zero are different facts. Google’s empty choices are zero and ignore; nan offers convert and ignore for nonnumeric data. The reference does not state defaults for these options, so the settings-range example makes both choices explicit.
Advanced example: a progress bar with a known denominator
Set M2 to 72 completed units and N2 to a target of 100. Use:
=SPARKLINE(M2,{"charttype","bar";"max",N2;"color1","green"})
The modeled progress is 72/100 = 72%; the expected bar occupies 72% of the specified horizontal scale. This is an expected visual proportion, not a pixel measurement from Sheets. Keep a numerical =M2/N2 percentage alongside the chart for accessibility and exact reading.
Check the target before plotting. A zero target makes the progress ratio undefined; a negative target usually indicates the wrong input convention for this particular model. Decide how to represent over-target progress instead of assuming that an unclipped or clipped chart is a policy decision.
Option reference by chart family
| Family | Documented options |
|---|---|
| Line | xmin, xmax, ymin, ymax, color, linewidth, empty, nan, rtl |
| Column and winloss | color, lowcolor, highcolor, firstcolor, lastcolor, negcolor, axis, axiscolor, empty, nan, rtl |
| Column only within that group | ymin, ymax; these do not apply to winloss |
| Bar | max, color1, color2, empty, nan, rtl |
Color options accept color names or hexadecimal codes. rtl selects right-to-left rendering with a Boolean setting. Axis options control whether an axis is drawn and its color. High/low/first/last/negative colors identify those categories of columns. For a winloss chart, the sign pattern matters rather than the relative size of each positive or negative observation.
The reviewed reference does not specify precedence when several highlighting colors apply to the same column, exact invalid-option error tokens, or every omitted-option default. Avoid relying on such undocumented details in a report.
Troubleshooting and availability
- Every row looks equally volatile: Set comparable explicit limits before comparing separate charts.
- A blank became a drop to zero: Inspect
emptyand choose the meaning appropriate to the data. - The options do not parse: Check the two-column pair structure and your locale’s array separators. A settings range is easier to inspect.
- A bar uses a line-only option: Select options from the correct family; bar charts use
maxfor their horizontal scale. - A retirement notice seems contradictory: Google’s separate sparkline chart-object notice says that former chart type is unavailable. The in-cell SPARKLINE formula remains documented in its own current reference. These are distinct documented interfaces; this guide concerns the formula.
The function’s introduction date and any retirement or last-working version were not established. Its current documentation is support evidence, not a native execution test.
Related guides
Use MIN and MAX to inspect series limits, SUM for totals, and AVERAGE for an adjacent numeric summary.
First-party references reviewed October 17, 2026: SPARKLINE, array syntax, and retired sparkline chart objects.