Home > front end >  Google Sheet Sparkline for every nth column
Google Sheet Sparkline for every nth column

Time:12-03

I would like to add a Sparkline to a sheet showing the evolution of a value.

My table looks like this

value #1 diff former value value #2 diff former value value #3 diff former value
Sparkline here Sparkline here Sparkline here
10 0 8 -2 9 1

My naive guess for the "Sparkline here" cell was (e.g. for C2)

    =SPARKLINE($A3:c3)

and for instance for E2

    =SPARKLINE($A3:e2)

unfortunately this takes the 0 (B3) and -2 (D2) into account.

Question: How can I create a sparkline that would only take every second value into account, i.e. 10, 8, 9. Best if this could be done without adding a helper row/column somewhere else.

CodePudding user response:

Try

=sparkline(filter(A3:F3, isodd(column(A3:F3)))) 

or, depending on your locale

=sparkline(filter(A3:F3; isodd(column(A3:F3))))

This will include only the 'odd' colummns in the specified range.

  • Related