SPARKLINE function

SPARKLINE displays a miniature chart within a cell to visualize data trends and patterns without taking up extra space.

=SPARKLINE(data, [options])

Generate a SPARKLINE formula

Describe what you need. The generator will reach for SPARKLINE where SPARKLINE is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How SPARKLINE reads its arguments
datarequiredoptionsoptionalSPARKLINE
ArgumentRequiredDescription
dataRequiredRequired. A single-row or single-column range or array of numeric values; empty or non-numeric data produces #N/A.
optionsOptionalOptional. An object specifying visual settings such as chartType, color1, max, and min; defaults to a line chart if omitted.

Returns

An in-cell chart visualization (sparkline) showing the data trend; not a numeric value.

Availability

Excel: Not available · Google Sheets: Supported

Worked examples

1. Show a student's quiz score progression

StudentSubjectAssignmentScoreMax Score
AliceMathQuiz 185100
AliceMathQuiz 292100
AliceMathQuiz 388100
BobMathQuiz 178100
=SPARKLINE(D2:D4)

Result: A line chart sparkline with three points (85, 92, 88) showing an upward peak at the middle value

SPARKLINE renders cells D2:D4—Alice's three Math quiz scores—as a tiny in-cell line chart. The visual peaks at 92, making the performance pattern instantly visible without leaving the spreadsheet.

2. Visualize percentage scores across assignments

StudentSubjectAssignmentScoreMax Score
AliceMathQuiz 185100
AliceMathQuiz 292100
AliceMathQuiz 388100
=SPARKLINE(ARRAYFORMULA(D2:D4/E2:E4))

Result: A line chart sparkline showing three normalized points (0.85, 0.92, 0.88) representing percentages

By dividing Score by Max Score, we convert raw grades to proportions. SPARKLINE visualizes these normalized values, allowing fair comparison even when quizzes had different point totals or difficulty levels.

3. Create a red column chart scaled to 100

StudentSubjectAssignmentScoreMax Score
AliceMathQuiz 185100
AliceMathQuiz 292100
AliceMathQuiz 388100
=SPARKLINE(D2:D4,{"chartType","column";"color1","#EA4335";"max",100})

Result: A column chart sparkline with red bars at heights 85, 92, and 88 on a 0–100 scale

The options parameter overrides defaults: chartType renders vertical columns instead of a line, color1 paints them red, and max sets the scale ceiling at 100. This emphasizes individual values and makes it easy to judge scores against the perfect maximum.

Common errors

Which SPARKLINE error are you seeing?
SPARKLINE returned an error#N/A
Ensure all cells in the range contain valid numeric data. Use IFERROR to exclude error values: =SPARKLINE(IFERROR(D2:D4,""))
#VALUE!
Review options carefully. Use this syntax: {"key1","value1";"key2","value2"}. Check that all keys are recognized: chartType, color1, color2, min, max, etc.
#REF!
Update the formula to reference valid cells, or use IFERROR to handle missing references gracefully: =IFERROR(SPARKLINE(D2:D4),"–")
ErrorWhy it happensHow to fix it
#N/AThe data array is empty or contains errors (like #DIV/0!) that SPARKLINE cannot render as a chart.Ensure all cells in the range contain valid numeric data. Use IFERROR to exclude error values: =SPARKLINE(IFERROR(D2:D4,""))
#VALUE!The options parameter has syntax errors, such as missing semicolons between key-value pairs, misquoted keys, or invalid setting names.Review options carefully. Use this syntax: {"key1","value1";"key2","value2"}. Check that all keys are recognized: chartType, color1, color2, min, max, etc.
#REF!The data range references cells that have been deleted, moved to another sheet, or no longer exist.Update the formula to reference valid cells, or use IFERROR to handle missing references gracefully: =IFERROR(SPARKLINE(D2:D4),"–")

Tips and when to use something else

  • SPARKLINE shines with 3–50 data points. For 100+ points or when you need legends, axis labels, and interactivity, use CHART() instead.
  • Pair SPARKLINE with FILTER() to create dynamic in-cell charts: =SPARKLINE(FILTER(scores, student='Charlie')) updates when the data changes.
  • To apply consistent formatting across many sparklines, define options in a helper cell and reference it, avoiding manual repetition.
  • Wrap SPARKLINE in IFERROR when data might be incomplete: =IFERROR(SPARKLINE(D2:D4),"–") displays a dash if data is missing.

Frequently asked questions

Can SPARKLINE update automatically when new data is added?
Yes. SPARKLINE recalculates instantly when source cells change. Use dynamic ranges with FILTER or QUERY: =SPARKLINE(QUERY(data,"select score where student='Alice'")) refreshes whenever the source data updates.
What chart types can SPARKLINE display?
Four types: line (default smooth curve), column (vertical bars), bar (horizontal bars), and winloss (displays positive/negative values as up/down spikes). Select via {"chartType","column"} in options.
How do I compare multiple students' grades with sparklines in one row?
Create separate SPARKLINE formulas in adjacent cells, each pulling a different student's data. Example: cell A has Alice's sparkline =SPARKLINE(QUERY(...student='Alice')), cell B has Bob's =SPARKLINE(QUERY(...student='Bob')).
Is SPARKLINE available in Microsoft Excel?
No. SPARKLINE is exclusive to Google Sheets. Excel has a built-in Sparklines feature (Insert > Sparklines), but it uses a different, non-formula interface.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17