Sheetsdrill

Sheets-only Updated November 2026

SPARKLINE

SPARKLINE(data, [options]) draws a tiny chart inside the formula cell from a range of numbers: a line by default, or a bar, column or winloss chart when you set charttype in the options. The options are written as a two-column array in braces, such as {"charttype","bar";"max",100}.

Syntax

=SPARKLINE(data, [options])
PartWhat it is
dataA row or column of numbers, for example B2:M2 for twelve months.
optionsOptional array of setting and value pairs: {"charttype","column";"color","green"}. Pairs are separated by semicolons, name and value by a comma.

Examples

=SPARKLINE(B2:M2)

Result: A small line chart of the twelve values

=SPARKLINE(B2, {"charttype","bar";"max",100;"color1","#4caf50"})

Result: A progress bar filled to B2 percent of the cell

With B2 = 65 the bar fills 65% of the cell width.

=SPARKLINE(B2:M2, {"charttype","column";"color","#1a73e8";"negcolor","red"})

Result: Column chart, negative months in red

Common mistakes

  • Writing options with a comma between pairs ({"charttype","bar","max",100}) gives an error; pairs are separated by semicolons (or backslashes in locales that use semicolons as argument separators).
  • A progress bar that always looks full is missing the max option; set "max" to the total, or to 100 for percentages stored as whole numbers.
  • Text or blank cells in the data stop the chart; use {"empty","zero"} or clean the range.

Practice it

The drills on Sheetsdrill check your answer on live data, free, no account needed.

Start practicing

Questions

How do I make a progress bar in Google Sheets?

=SPARKLINE(A2, {"charttype","bar";"max",1}) when A2 is a fraction like 0.65, or max 100 when it is a whole percent.

Can I change the sparkline color based on the value?

Yes, by building the option with IF: {"charttype","bar";"max",1;"color1",IF(A2<0.5,"red","green")}.

Related

  • SUM and AVERAGEHow SUM and AVERAGE work in Google Sheets, with examples for a column total, average order value, share of total with locked references, and why you get 0.
  • TEXTHow the TEXT function in Google Sheets turns a number or date into formatted text: month labels, currency, percentages and leading zeros, with common codes.
  • IFHow the IF function in Google Sheets returns one value when a condition is true and another when it is false, with examples for text, blanks and nested IFs.
  • QUERYHow the Google Sheets QUERY function works: the SQL-like syntax, select and where, group by with sum and count, order by, limit, and the errors people hit.

Previous: REGEXMATCH, REGEXEXTRACT and REGEXREPLACENext: VLOOKUP