SPARKLINE

Draw a range of numbers as a row of block characters in a single cell — a trend you can read at a glance beside the data.

Syntax

SPARKLINE(data, [type])
Argument Required Description
data Required The numbers to draw, in order.
type Optional "bar" (the default) or "winloss". "line" is accepted and currently draws the same as "bar".

Examples

Every example below was executed against VisiGrid engine 0.54.0 — not transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.

Formula Result Notes
=SPARKLINE(B2:B4) ▁█▅ Lowest value is the shortest bar, highest the tallest.
=SPARKLINE(C2:C5,"winloss") ▲▼▲▼ Only the sign matters — up for positive, down for negative.
=SPARKLINE(B2:B4,"pie") Unknown sparkline type: pie. Use 'bar', 'line', or 'winloss'

Text, not a picture

The result is ordinary text made of the Unicode block characters ▁▂▃▄▅▆▇█, scaled so the smallest value in the range is the lowest block and the largest is the highest. Because it is text it copies, exports to CSV and shows in a terminal, and it recalculates like any other formula.

Win/loss

"winloss" ignores size and shows only direction — useful for months over or under target, or days up or down.

Portability

Neither Excel nor Google Sheets will read this formula the same way: Excel has no SPARKLINE function, and Sheets’ version draws an image and takes an options object. In a file that has to open elsewhere, use the text it produces (paste as values) rather than the formula.

Excel compatibility

VisiGrid's own function. Excel has sparklines as a chart feature rather than a formula, and Google Sheets' SPARKLINE draws a graphic with different options, so a formula using it will not carry over to either.

Related functions

Last updated