Hi Edd,
Unfortunately, you cannot use the
IF function directly in a chart to choose its data series. However, there is a workaround that you can use to achieve the desired result.
Here are the steps to follow:
- Create both data series in your worksheet, one for when A1 equals 1 and the other for when A1 equals 2.
- Create a third column that uses the IF function to determine which data series to use based on the value in A1. For example, if your data series are in columns B and C, your formula in column D could be "=".
- Copy the formula in column D down to all the rows that contain data.
- Create your chart using the data in column D as the data source.
By using this workaround, your chart will dynamically choose the correct data series based on the value in A1. If A1 changes, the chart will automatically update to reflect the new data series.