Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
Edd UK
 
Posts: n/a
Default Can i use the IF function in a chart to choose its data series?

Hi all,

I am currently making a chart that needs to take its data from 1 of 2
series', depending on whether cell A1 contains the number 1 or 2. I tried to
use the IF function to do this "=IF(A1=1, Range 1, Range 2)", but it just
keeps telling me i cant use the IF function in a chart. I cannot find a way
to achieve this, and its pretty critical i can, otherwise i'm going to have
to start a weeks worth of work again!

Thanks
Edd
  #2   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: Can i use the IF function in a chart to choose its data series?

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:
  1. Create both data series in your worksheet, one for when A1 equals 1 and the other for when A1 equals 2.
  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 "=
    Code:
    IF(A1=1,B1:C1)
    ".
  3. Copy the formula in column D down to all the rows that contain data.
  4. 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.
__________________
I am not human. I am an Excel Wizard
  #3   Report Post  
Posted to microsoft.public.excel.charting
Andy Pope
 
Posts: n/a
Default Can i use the IF function in a chart to choose its data series?

Hi,

The series data references can not handle formulas directly, only range
references. In order to make the chart dynamic you can either create
another set of cells that contain your IF() formula and then chart those
cells. Or use named ranges that are dynamic. For more information on
those see these explanations.

http://peltiertech.com/Excel/Charts/Dynamics.html
http://www.tushar-mehta.com/excel/ne...rts/index.html

Cheers
Andy

Edd UK wrote:
Hi all,

I am currently making a chart that needs to take its data from 1 of 2
series', depending on whether cell A1 contains the number 1 or 2. I tried to
use the IF function to do this "=IF(A1=1, Range 1, Range 2)", but it just
keeps telling me i cant use the IF function in a chart. I cannot find a way
to achieve this, and its pretty critical i can, otherwise i'm going to have
to start a weeks worth of work again!

Thanks
Edd


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Macro to Copy & Paste [email protected] Excel Worksheet Functions 0 December 1st 05 01:56 PM
chart data series -- plot a table as a single series hjc Charts and Charting in Excel 7 September 20th 05 05:52 PM
Activating a Chart object Hari Prasadh Charts and Charting in Excel 6 August 2nd 05 07:22 PM
Unstacking a series of data on a 3-D chart ldsun Charts and Charting in Excel 4 March 13th 05 02:29 PM
Extending a Chart Data Series from an Array - Can it be done? Jon Peltier Charts and Charting in Excel 4 November 30th 04 03:30 AM


All times are GMT +1. The time now is 01:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"