Quick Answer

SPARKLINE Function

SPARKLINE draws a tiny chart in a cell from a range of numbers, with options for line, bar, column, and win/loss charts.

✓ Excel✓ Google SheetsExcel Google Sheets only

Syntax

SPARKLINE
(data, [options])

Parameters

ParameterDescriptionRequired
dataThe range or array of numeric values to chart. Must be one-dimensional (a single row or column).Required
optionsAn optional string or array of options to customize the chart, such as charttype, color, linewidth, max, min, etc.Optional

Basic Example

Create a simple line sparkline for monthly sales

=SPARKLINE(A2:A13)
ResultMini line chart in cell

A2:A13 contains monthly sales numbers. SPARKLINE draws a small line chart in the cell.

Advanced Examples

Example 1: Column sparkline with color

Daily performance

Show daily values as colored columns

=SPARKLINE(B2:B31, {'charttype', 'column'; 'color', 'blue'})
Result: Mini column chart in blue
The options specify a column chart with blue bars. Options are passed as an array of key-value pairs.

Example 2: Win/loss sparkline

Profit/loss tracking

Show positive values as blue wins and negative values as red losses

=SPARKLINE(C2:C20, {'charttype', 'winloss'; 'negcolor', 'red'; 'poscolor', 'green'})
Result: Win/loss chart in cell
Win/loss charts show only whether each value is positive or negative, not the magnitude.

How SPARKLINE Works

SPARKLINE takes a one-dimensional range of numbers and renders a small chart in the cell. The chart type and appearance are controlled by an options array. Supported types include line, bar, column, and win/loss. The chart resizes automatically with the cell.

1
Select the data range
Choose a single row or column of numbers.
2
Choose a chart type
Default is line. Use 'column', 'bar', or 'winloss' for other styles.
3
Add options
Pass options as {'option', value; ...} to customize color, min, max, etc.
4
Enter the formula
Type =SPARKLINE(data, options).

Important Notes & Limitations

  • SPARKLINE is Google Sheets only. Excel has its own Sparkline feature via Insert > Sparkline, but not as a worksheet function.

  • Only one-dimensional data works; a 2D range will cause an error.

  • Advanced chart customization is limited compared to full charts.

  • Text and empty cells in the data range may cause errors or gaps.

Common Errors & Fixes

#VALUE! errorThe data range is two-dimensional or contains non-numeric values.

Fix: Use a single row or column and ensure all values are numbers.

Chart not appearingThe cell is too small or the formula returned an error.

Fix: Widen the cell and check the formula for errors.

Options not appliedOptions syntax is incorrect.

Fix: Use the array syntax {'key', value; 'key2', value2} with semicolons separating rows.

Download Practice File

Practice SPARKLINE with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the SPARKLINE function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

Can SPARKLINE show multiple series?
No, it only supports one-dimensional data. For multiple series, use a full chart.
Can I use SPARKLINE in Excel?
Excel has Sparkline charts via Insert > Sparkline, but not a SPARKLINE worksheet function.
How do I change the line color?
Use the color option: =SPARKLINE(A2:A13, {'color', 'red'}).
Can I highlight the maximum value?
Yes, use the highcolor option or combine with max in a custom formula for conditional coloring.