Google Sheets – Create Sparkline for Delta Between Columns

google sheets

Lets say I have data like so…

A     B     C     D     E
50   100   125   175   225

I want to create a sparkline that will show the difference between each column

SPARKLINE( [B-A, C-B, D-C, E-D])

But, I don't want to make my spreadsheet have 2x the number of rows in order to calculate the intermediate result.

Is there a function that will take a range of cells and return an array after apply some math on the input range?

Compute Data on range of data

Edit: Solution proposed worked perfectly… Here's what it looks like when applied.

enter image description here

Best Answer

Use arrayformula to perform operations on arrays, for example

=sparkline(arrayformula(B2:E2 - A2:D2))

plots the sparkline of differences B2-A2,..., E2-D2.