+ Reply to Thread
Results 1 to 13 of 13

Dynamic X Axis

  1. #1
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Dynamic X Axis

    Hey Guys,

    Bit of advice really.

    I have a graph, and within the series there are some points which are '0'.

    What I'm trying to do is if these points are 0 not to display the series on the x axis.

    I know of 2 ways to do it

    1) Hide row - This will take out that series point
    2) Using Auto filter - Similar to above

    This isn't always practicle as there is sometimes important data to the left, or right of the table which I don't want to hide using the above methods.

    So is there any other way?

    Attached is a sample work book, with sample data.
    Attached Files Attached Files

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Dynamic X Axis

    JJ,

    you need to calculate the list of values you want to show, create a list of these values only, create a dynamic range that grows and shrinks automatically and then chart that dynamic range.

    Clear as mud? See attached with formulas doing the work. No array formulas!!

    cheers
    Attached Files Attached Files
    Last edited by teylyn; 02-24-2010 at 05:18 PM.

  3. #3
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Dynamic X Axis

    Ok,

    Works just how I need it to but I am stumped on 1 thing.

    When I insert>name>define name and set ChartLabels to:

    ='Data (ALL)'!$O$3:INDEX('Data (ALL)'!$O:$O,COUNTA('Data (ALL)'!$O$3:$O$61)-2,1)

    It seems that its Indexing to much as it highlights beyond the displayed text?

    EDIT:

    The above problem still exists, but I've found something else.

    On the attached example if you change one of the catagories from 0 to a number, eg Orange.

    The graph only has a defined range, not a dynamic one as its set and cuts data off?
    Last edited by jj72uk; 02-25-2010 at 07:42 AM.

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Dynamic X Axis

    attached example
    attached where?

    It seems that its Indexing to much as it highlights beyond the displayed text?
    hard to tell without seeing your data.

    On the attached example if you change one of the catagories from 0 to a number, eg Orange.

    The graph only has a defined range, not a dynamic one as its set and cuts data off?
    In the file I attached you can change any zero to a number and it will pop up in the chart.
    Last edited by teylyn; 02-25-2010 at 07:48 AM.

  5. #5
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Dynamic X Axis

    Sorry Tey, I was referring to your own example, if you have more than 6 catagories the graph will cut it off.

    Looks like your graph only shows a max of 6 catagories?

    I've attached my sheet that I'm working on it in the Data (ALL) tab and its the bottom graph, the top graph is a pivot chart and will be deleted once this works

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Dynamic X Axis

    JJ, didn't get to download your chart, but realised I have to refine my INDEX skills.

    replace the range definition for ChartLabels with the (volatile) Offset variant

    =OFFSET(Sheet1!$E$1,1,0,COUNTA(Sheet1!E:E)-1,1)

  7. #7
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Dynamic X Axis

    Don't worry about my sheet as its a straight cross over of the demo sheet.

    The OFFSET deffinatly helps and works.

    The only down side is now we have blank catagories on the chart?

  8. #8
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Dynamic X Axis

    New take. Awake now. A few hours of sleep can do wonders.

    formula for E2 and down

    =IF(ROW(D2)-ROW(D$2)+1>COUNT(D$2:D$10),0,INDEX(A:A,SMALL(D$2:D$10,1+ROW(D2)-ROW(D$2))))

    Index formula for range name ChartLabels

    =Sheet1!$E$2:INDEX(Sheet1!$E$1:$E$10,MATCH("zzz",Sheet1!$E$1:$E$10,1),0)

    see attached.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    03-26-2012
    Location
    Cambridge, England09
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Dynamic X Axis

    This a brilliant bit of excel work, thanks for posting it. You just solved a big problem I was having with a spreadsheet.

  10. #10
    Registered User
    Join Date
    11-01-2012
    Location
    Southampton, England
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Dynamic X Axis

    This is fantastic

    I apologise if this is a silly question but is there any way to get it for more than 10 rows? I currently have 42 rows which will soon increase to 50. The current maximum amount of non-zero output is 24. IE I want to have a graph with 24 bars which changes based on data from vlook ups.

    Is this increase of bars possible? If so, how? I've had a play around with your spreadsheet but can't seem to adapt it properly.

    Thankyou,

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Dynamic X Axis

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  12. #12
    Registered User
    Join Date
    09-24-2015
    Location
    Jimbaran
    MS-Off Ver
    2013
    Posts
    1

    Re: Dynamic X Axis

    tidy up formula and use table.
    Attached Files Attached Files

  13. #13
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,462

    Re: Dynamic X Axis

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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