+ Reply to Thread
Results 1 to 6 of 6

To be able to toggle the data by 2 fields to display graph

  1. #1
    Forum Contributor
    Join Date
    05-16-2018
    Location
    SG
    MS-Off Ver
    2013
    Posts
    217

    To be able to toggle the data by 2 fields to display graph

    Hi All,

    I need some help on a graph chart I am working on. On sheet1 will be where i have a graph chart showing there series of costs for location 1, location 2 and the total costs for both location 1 and location 2. I have the data for these 3 series over the course of a few years in the sheet named tab. I have the costs tabulated in both a vertical and horizontal table. The issue i really could use help figuring out is on sheet 1, I will need the graph table to be able display to toggle by the below selection. The current graph shows the data for the year 2019 alone and i will need to manually refigure the data to show another year/location. Hope i can get some help on this. I will be really appreciative of it.

    Cell Q2 - Location
    1. Location 1
    2. Location 2
    3. Location 1 & Location 2 and Total of both locations

    Cell T2 - Year
    1. Year 2015
    2. Year 2016
    3. Year 2017
    4. Year 2018
    5. Year 2019
    6. Year 2020

  2. #2
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: To be able to toggle the data by 2 fields to display graph

    I think this will get you close to where you need to be.

    you should have a special table that is filled with the year you want to present and link that to the graph and when you change T2 or Q2 then this table gets updated and there is no need to move down the individual ranges the ranges in the graph are always the same.
    For my convienience I build that table on sheet1. but can offcourse be on costs sheets as well.
    What I did is build a formula that will show the months depending on the year in T2 and the location depending on Q2.

    Also to avoid lines running along the X axis for unfilled month I put a forced error N/A in the formulas so the line tops after april as long as a month (in this case june) is not started yet
    The graph will however always show all months of a year, filled or unfilled. on the X axis.
    Also I set the Y axis to a fixed maximum of 350 so that when you only select 1 location the graph does not resize due to auto sizing because a location has lower value.

    please see attachment for the formula and effect on the graph
    Attached Files Attached Files

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: To be able to toggle the data by 2 fields to display graph

    Hi

    To complement the good work of @Roel Jongman
    Use in Sheet1!C2 (or other) the formula

    =T2 & " Total Electricity Costs"

    Select the title of the chart and in formula bar use =C2

    So, the title are updated when you change the year.

  4. #4
    Forum Contributor
    Join Date
    05-16-2018
    Location
    SG
    MS-Off Ver
    2013
    Posts
    217

    Re: To be able to toggle the data by 2 fields to display graph

    Thank you very @Roel Jongman and @Jose Augusto. It really worked!! Can i check instead of an N/A error can i leave it as a blank. Reason being i would like to display the data labels if possible

  5. #5
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: To be able to toggle the data by 2 fields to display graph

    You can change them for Loc 1 and Loc 2 formulas that will then show 0,00 instead of #na.
    for the line and total you need the forced error to not have the strange linedrop. but there is no Issue there, it hides both the label and the line..

    I did not like the zero's showing for months without values so I was able to format them to hide also with numberformatting.
    you can read here how I set it up.. https://www.extendoffice.com/documen...ta-labels.html

    Seems like a very presentable chart this way
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    05-16-2018
    Location
    SG
    MS-Off Ver
    2013
    Posts
    217

    Re: To be able to toggle the data by 2 fields to display graph

    Thank you!!

+ 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] Invoke Pivot Table by Coding and Display Fields Data
    By Quivolt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-22-2017, 01:02 PM
  2. Replies: 0
    Last Post: 02-25-2016, 10:22 PM
  3. Subtotal all data and display on bar graph
    By otsegonaut in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 06-29-2013, 07:24 PM
  4. Toggle Graph Series?
    By marshymell0 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-22-2013, 05:27 PM
  5. [SOLVED] Excluding Entire Data Fields in a Graph
    By Steve D in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 06-27-2006, 04:40 PM
  6. Toggle on/off switch for x-y graph
    By Brad in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 08-18-2005, 11:05 PM
  7. [SOLVED] Is there a way to toggle cells between display of referenced data.
    By williejoeshaver in forum Excel General
    Replies: 3
    Last Post: 03-11-2005, 08:06 PM

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