samedi 9 novembre 2019

Using SWITCH to with SPARKLINES to Color Primary Bar Different Colors

I'm looking for the best way to change the color or the primary bar of a sparkline based on it's value. This is for a budgeting worksheet. I'd like the primary bar to blue when it's still under the total year budget, green when it's exactly the total year budget and red when it exceeds the total year budget. I tried to use the SWITCH function to this but it's not working. Any ideas and help greatly appreciated. Here's what I'm trying and is not working. E24 is the cell where I want the sparkline to show. H is the cell with the actual spend and F is the cell with the budgeted amount.

Thanks much for any help to achieve this.

= SWITCH(E24, ABS(H24)<F24,(SPARKLINE(H24,{"charttype","bar";"max",F24;"color1","#2E86DE"})),
ABS(H24)>F24,(SPARKLINE(H24,{"charttype","bar";"max",F24;"color1","#de4c60"})),
ABS(H24)=F24,(SPARKLINE(H24,{"charttype","bar";"max",F24;"color1","#69C569"})),
SPARKLINE(H24,{"charttype","bar";"max",F24;"color1","#000000"}))

Aucun commentaire:

Enregistrer un commentaire