Setting a chart y-Axis on a Secondary Axis - breaks the x-Axis formatting

morsagmon

New Member
Joined
May 6, 2015
Messages
28
Hi.

I have a simple, two lines chart.
My X-Axis range has dates, linked to source.
As soon as I define one of the y-axis lines to be on a secondary axis - the dates formatting of the x-Axis are removed and all labels are shows as a sequence of numbers: 1 2 3 4 5 6...
Setting it back on the primary axis - shows the X-axis labels correctly.

X-Axis Y-Values1Y-Values2
Jan-17454658
Feb-17336845
Mar-17407651
Apr-17293486

<tbody>
</tbody>

I tries forcing x-Axis Type to be Date Axis - no effect.
Any ideas on how to retain the X-axis formatting to be linked to source and show the dates, while two Y-axis in effect?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I think you are using a line chart, correct?

I believe your dates are text, not Excel serial number dates. Try this:

Change the first date to a true Excel date: 01/01/2017.
Right-click and drag from that cell downward. Choose "Fill Months" from the popup context menu.
Format the date cells using a custom number format, mmm-yy
Now create your line chart.
 
Upvote 0
Thanks, thisoldman.
The cells are formatted as dates. Not only they are formatted as dates, I'm alternating their formatting between "[$-40D]mmm-yy;@" (if chart showing last 12 months) and "yyyy" (if chart showing last 5 years) - this is done in VBA and the cells comply beautifully. Also, note that when both lines are on the primary axis, the current date format of the cells is applied to the x-Axis chart just fine.
 
Last edited:
Upvote 0
I did not have a problem when I manually create the chart. You probably want to post the VBA code so that someone can take a look. My own VBA skills are not that good.
 
Upvote 0
OK,
I recreated the chart from scratch (one more time), at the same sheet where the staging data is, and it now works. I moved it to the dashboard sheet - still works!
Let's hope that glitch is gone forever...
Thank you!
 
Upvote 0
Good to hear! Intermittent errors are the worst to troubleshoot—I'll keep some virtual fingers crossed.
 
Upvote 0

Forum statistics

Threads
1,215,632
Messages
6,125,909
Members
449,274
Latest member
mrcsbenson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top