+ Reply to Thread
Results 1 to 15 of 15

Secondary Horizontal date axis

  1. #1
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    179

    Secondary Horizontal date axis

    Gurus,

    I am attempting to get a secondary axis that shows the dates included in a data range. Its has been formatted using dates, but I cannot get it to read the actual dates in the data range. I am sure it something simple that I am missing. I am not very familiar with using charts.

    Please see my example.

    TIA,
    Tim
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Secondary Horizontal date axis

    I don't know if this is what you want, but I selected the Axis and clicked on the buttons to reset the Minimum and Maximum and Major Units.
    Attached Images Attached Images
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Secondary Horizontal date axis

    I am not certain what you are trying to do here, so I'm not sure how helpful I can be.

    I note that your secondary axis is formatted with a minimum of 0 and a maximum of 1. The underlying values/serial numbers behind those dates will be 42000+, so there is no way that those dates will be correctly displayed on a 0 to 1 scale. The first adjusment I would make would be to set the maximum and minimum of the secondary axis to auto or to something more reasonable for the dates you are trying to display. You might go into the range with the dates and delete the number format so you can see what the actual serial numbers are for those dates, so you can choose better values for the axis max and min and divisions.

    I would guess that there is a lot more you want to do here. If you can explain what you want to do, we may be better able to help you.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    179

    Re: Secondary Horizontal date axis

    dflak,

    I want the data (in the form of a date or text, which ever is easier) to line up with the vertical grid line. With your help I got the as far as some random dates showing up but I want the specific date in the data to show.

    Chart.jpg
    data.jpg

    Thanks,
    Tim

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Secondary Horizontal date axis

    Set the axis limits to min 42443 (the serial number for 3/14/2016), max 42453 (serial number for 3/24/2016), and major unit 1? As I suggested , clearing number/date format so you can see the underlying serial numbers is useful here.

  6. #6
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    179

    Re: Secondary Horizontal date axis

    Mr. Shorty,

    The dates were examples and will change. Which is why I am thinking the format should be text. What do you think?

    Tim

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Secondary Horizontal date axis

    I generally don't like converting numbers/dates to text. I cannot visualize what you are trying to do here, but, in a situation like this, I will often try to see how Excel's automatic axis limits work out. If they really don't work out, then I will usually just manually adjust the axis limits for each data set (it doesn't take long).

    I have seen VBA procedures that can be used to automate axis limits using your own algorithms. Let me know if you would want to go down that rabbit hole.

    In this case, it might be useful to convert the secondary series and axis system to a column chart instead of a bar chart. Then, add the secondary horizontal axis and format it as a text (rather than date) axis. That might be worth trying to see what happens and how that could be adapted. Is that what you are thinking of?

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Secondary Horizontal date axis

    Change the second series to column chart.
    Delete secondary vertical axis
    Add secondary horizontal axis, format to cross on tickmarks and display text

    The dates will only line up though if you have match dates for each percent band.

    ** attachment remove **
    see newer post for correct file
    Last edited by Andy Pope; 09-17-2016 at 04:31 AM. Reason: Wrong examlpe file attached.
    Cheers
    Andy
    www.andypope.info

  9. #9
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    179

    Re: Secondary Horizontal date axis

    MrShorty,

    I really need to maintain the current bar chart.

    There will be several users at various excel knowledge levels. So, I must keep it simple. It will not be possible to teach everyone how to manually update the axis limits for each data set.

    It was requested by a single user that he needs to put "milestone" dates at every 10% grid line. He has been doing this for 20 years on an older version of this worksheet and he won't give it up.

    For these reasons, I would like to transfer the data to text. the dates mean nothing and can quickly be updated by changing the data set. Is it possible for the secondary horizontal axis to use text? If so, that is where I need assistance.

    Thanks,
    Tim

  10. #10
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Secondary Horizontal date axis

    Here’s my latest shot. It uses a change event on the Input Data page to set the minimum and maximum date for the axis based on the min and max dates in the data.

    I have a couple of helper cells on the Parameters page to collect these dates. The parameters page can be hidden.
    Attached Files Attached Files

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Secondary Horizontal date axis

    Is it possible for the secondary horizontal axis to use text?
    On a bar chart, the horizontal axes are value axes, so they do not know how to use text.

    The main technique I'm aware of for putting text on a value axis is to use a dummy series and data labels: http://peltiertech.com/Excel/Charts/Y_CategoryAxis.html The tutorial is for a column chart, but should be essentially the same process for a bar chart.

    You say that you have a user who has been doing this for 20 years on an older version of the worksheet. I would be curious how he/she has been maintaining/formatting the secondary axis.

  12. #12
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    179

    Re: Secondary Horizontal date axis

    dflak,

    Ok... I think I can run with this. However I am curious as to how you are setting the graph parameters. Are you using the cell names (Mindate and Maxdate) or the 2 macros that were created. Or the combination of both the names and macros.

    I would like to understand for the future.

    Thanks,
    Tim

  13. #13
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Secondary Horizontal date axis

    Oops. I meant to delete all those other modules. They were recorded macros so I could figure out the syntax. What runs the show is the change event on the input sheet.
    Please Login or Register  to view this content.
    I set it up this way so that when dates are added or changed, the macro is kicked off. I gave a static name to the two cells on the Parameter pages and read them into the code. VBA doesn't have a native Min or Max function. I could have written one, but Excel has a built in one so I used it instead.

  14. #14
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Secondary Horizontal date axis

    I see I attached the file for a different problem.

    See this one where the column chart axis displays the dates.
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    06-21-2013
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    179

    Re: Secondary Horizontal date axis

    Dflak,


    Looks like you nailed it. Well at least pointed me in the right direction. Couldn't do it without your help.

    Thanks to you and all those that responded with ideas!

    Tim

+ 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. How to add secondary horizontal axis?
    By Kyler.Kooi in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-15-2016, 01:24 AM
  2. [SOLVED] Customizing the Secondary Horizontal Axis
    By mkenny13 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-07-2016, 02:24 PM
  3. [SOLVED] Secondary horizontal axis problem
    By silkpantsman in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 06-23-2015, 06:44 AM
  4. Replies: 2
    Last Post: 04-15-2015, 01:10 AM
  5. Log horizontal axis with secondary virtical
    By jqavins in forum Excel General
    Replies: 5
    Last Post: 09-29-2011, 10:25 AM
  6. Replies: 2
    Last Post: 03-11-2011, 09:02 AM
  7. Replies: 6
    Last Post: 12-07-2010, 02:54 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