+ Reply to Thread
Results 1 to 8 of 8

Can a Chart dynamically change it range based on a cells value?

  1. #1
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    384

    Can a Chart dynamically change it range based on a cells value?

    I am not sure where to post this question so I thought Charting would be a good start.

    I have a chart with the formula below.

    Please Login or Register  to view this content.
    If I have a cell lets say B10 on a worksheet automatically changes. Can the chart as defined below do the follow. If B10 is has "NID" in it the chart plots one less data point.
    Please Login or Register  to view this content.
    If that cell does not contain "NID" then it plots one more data point:
    Please Login or Register  to view this content.
    I am not sure how to best accomplish this task automatically. VBA code formulas???
    Last edited by Bobbbo; 09-14-2017 at 03:39 PM. Reason: Mark it solved

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Can a Chart dynamically change it range based on a cells value?

    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced next to Quick Post button at the bottom right of the editor box.
    • Scroll down until you see "Manage Attachments",
    • Click the "Choose" button at the upper left (upload from your computer).
    • Select your file, click "open", click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Close the Attachment Manager window.
    • Click "Submit Reply"
    Note: Please do not attach password protected workbooks/worksheets
    Ensure to disable any Workbook Open/Autorun macros before attaching!
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    384

    Re: Can a Chart dynamically change it range based on a cells value?

    Okay, I have created an example attached. In the attached workbook I have the titles and the data above the charts in cells D2:T3. Cell D5 has a formula that answers the question of "Is there Benchmark Data?"
    If cell T3 is blank, the answer will be NO. If the answer is "NO" I want the "Benchmark" column to removed from the chart. I have two charts below with the desired results.
    Attached Files Attached Files

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Can a Chart dynamically change it range based on a cells value?

    You can try with PowerQuery (PowerQuery & PowerPivot - add-ins for Ex2010) and Worksheet_change to refresh query connection automatically. So at the end anyway - vba
    or
    maybe someone else will give you another solution
    Last edited by sandy666; 09-08-2017 at 09:51 PM. Reason: add-ins

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Can a Chart dynamically change it range based on a cells value?

    Dynamic Named Ranges:

    AbsissaVals =Sheet1!$D$2:INDEX(Sheet1!$2:$2,1,COUNT(Sheet1!$3:$3)+4)
    chartDATA =Sheet1!$D$3:INDEX(Sheet1!$3:$3,1,COUNT(Sheet1!$3:$3)+4)

    (the ranges expand by one if there is a value in the benchmark cell)
    Attached Files Attached Files
    Last edited by protonLeah; 09-09-2017 at 12:32 AM.

  6. #6
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    384

    Re: Can a Chart dynamically change it range based on a cells value?

    Quote Originally Posted by protonLeah View Post
    Dynamic Named Ranges:

    AbsissaVals =Sheet1!$D$2:INDEX(Sheet1!$2:$2,1,COUNT(Sheet1!$3:$3)+4)
    chartDATA =Sheet1!$D$3:INDEX(Sheet1!$3:$3,1,COUNT(Sheet1!$3:$3)+4)

    (the ranges expand by one if there is a value in the benchmark cell)
    Thanks protonLeah, it works great. The actual need to to have a cell on the worksheet such as D5 determine if it plots the "Benchmark" value and label. If D5 had a value of YES (plot the Benchmark) or NO (do not plot the bench) how can I make what you did key off that cell insted of the actual data being present or absent?

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Can a Chart dynamically change it range based on a cells value?

    Please Login or Register  to view this content.
    IF D5 = YES, 1*(Sheet1!$D$5="YES") = 1
    IF D5 = NO, 1*(Sheet1!$D$5="YES") = 0
    Last edited by protonLeah; 09-09-2017 at 02:46 PM.

  8. #8
    Forum Contributor
    Join Date
    04-05-2010
    Location
    Lakewood, IL
    MS-Off Ver
    Excel 2016
    Posts
    384

    Re: Can a Chart dynamically change it range based on a cells value?

    Quote Originally Posted by protonLeah View Post
    Please Login or Register  to view this content.
    IF D5 = YES, 1*(Sheet1!$D$5="YES") = 1
    IF D5 = NO, 1*(Sheet1!$D$5="YES") = 0
    Exellent, Thank you so much!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. SOLVED-Dynamically change size/range of x axis of chart
    By helpme858 in forum Excel General
    Replies: 2
    Last Post: 08-07-2017, 12:20 PM
  2. Using Cells to change Pie Chart range
    By mrshl9898 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-04-2017, 09:50 PM
  3. Replies: 3
    Last Post: 06-28-2016, 04:24 AM
  4. Dynamically populate a row of cells based on value and date range
    By Paul.Thompson in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-27-2016, 05:01 PM
  5. Dynamically change how values are displayed in a chart?
    By Sthlm in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 12-27-2013, 05:43 AM
  6. Change the range in x axis dynamically for line chart
    By dimwit in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-27-2013, 05:23 AM
  7. use mouseclick to dynamically change chart series? Chart_beforeDoubleClick?
    By KR in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2006, 10:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1