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.
Syntax
Parameters
| Parameter | Description | Required |
|---|---|---|
| data | The range or array of numeric values to chart. Must be one-dimensional (a single row or column). | Required |
| options | An 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)A2:A13 contains monthly sales numbers. SPARKLINE draws a small line chart in the cell.
Advanced Examples
Example 1: Column sparkline with color
Daily performanceShow daily values as colored columns
=SPARKLINE(B2:B31, {'charttype', 'column'; 'color', 'blue'})Example 2: Win/loss sparkline
Profit/loss trackingShow positive values as blue wins and negative values as red losses
=SPARKLINE(C2:C20, {'charttype', 'winloss'; 'negcolor', 'red'; 'poscolor', 'green'})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.
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
SPARKLINE
sparklinePractice 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.
File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps