Chart with if statement

In this article we will learn how to create chat with if statements. The IF conditions are created in the data series which can be used as checkboxes to change the charts as per the requirements.

Let us start by creating chart data for the same. Now we can clearly see that there are 2 category of products. Simple graph will look like this:

create a chart with if statement simple graph

Now we will start creating the options for the same. We created new columns which have the following formulas: =IF(J1,C1,E1)

This if condition decides if the chart will have column C or E as its series.

So based on value in cell j1 it can be product2 or Products A =IF(J1,D1,F1)

This if condition decides if the chart will have column D or F as its series. 

For based on value in cell j1 it can be product3 or Products B So now we have added a checkbox and linked it to the cell j1 and in the graph we have changed the series types including product1 and last 2 column products which can vary.

create a chart with if statement checkbox

Unchecking the option:

create a chart with if statement checkbox unchecked

You can easily check the same in the linked file.