I have three columns of data that I want to represent with sparklines as a stacked bar chart.

For instance, a row like

12  5   1

with this formula


shows an image like this: Sparkline chart

As you can see, the first and third colors are the same. I would like to specify all three colors, so that the first and third colors are different.

Google's SPARKLINE Help docs indicate bar charts set two colors by default; these can be user specified as color1 and color2. They do not provide any instructions for specifying additional colors.

I have tried specifying color1, color2, AND color3, and I have tried specifying lastcolor; neither option alters the third color. I also tried setting just color, then specifying color1 and color2 as a default, to see if Sheets would default to the setting for color for the third color. That did not work either.

Is there a way to set the 3rd color to be different from the first color?

  • 1
    Welcome to Web Applications. Have you already read SPARKLINE | Google Docs Help? Please show what you tried and add a brief descirption of your search/research efforts as is suggested in How to Ask.
    – Rubén
    Dec 10, 2020 at 16:17
  • Done. Many thanks. Dec 10, 2020 at 17:43
  • Add some sample data and the formula that you tried.
    – Rubén
    Dec 10, 2020 at 17:54
  • Those have been added. Dec 10, 2020 at 20:30

3 Answers 3


From the question:

Is there a way to set the 3rd color to be different from the first color?

No, there isn't.

According the the SPARKLINE official help article, the options for a SPARKLINE bar chart are

For bar charts:

  • "max" sets the maximum value along the horizontal axis.
  • "color1" sets the first color used for bars in the chart.
  • "color2" sets the second color used for bars in the chart.
  • "empty" sets how to treat empty cells. Possible corresponding values include: "zero" or "ignore".
  • "nan" sets how to treat cells with non-numeric data. Options are: "convert" and "ignore".
  • "rtl" determines whether or not the chart is rendered right to left. Options are true or false.

As you can see, ther only two possible options for setting bar colors, color1 and color2


You may switch the color by add "a3bc9f" (the color code in double citation mark) to change the color.

Like this: =SPARKLINE(B4:C4,{"charttype","bar";"color1",if(B4>C4,"#dd7e6b","a3bc9f");"color2",if(C4>B4,"#dd7e6b","a3bc9f")})

  • Ximugu, thanks for this, but it still seems to create only two colors in the chart. My question was "Can you have three colors or more in a 'bar' sparkline?" Sadly, the answer seems to be "No." Feb 27, 2021 at 2:45

You can't add more than two colors to the bar chart. HOWEVER, you can get a similar result with this waterfall of bar charts. Just make the first color white, and make a table of the sum of the previous values. The formula for second bar chart looks like this:


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.