Carriage return in Chart Axis custom format

wildpark

New Member
Joined
Nov 26, 2010
Messages
8
Hi all,

I have a chart with a custom date format for the horizontal axis, inherited from someone else. The custom date format is mmm[]yyy (where the [] is actually a square box, indicating a non displayable character.

The effect of that non-displayable character is to push a carriage return into the chart axis, so that the month displays on a different line to the year.

This is all fine, but I have no idea what that character is, or how I can enter it into another worksheet.

Any ideas? I'm on Excel 2007.

I've tried copying the custom format, but in the Format Code box it simply shows mmm and that's all I can copy.
I can't type Alt-Enter into the Format Code box.
I can't type Alt-020 there.
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I do something similar, but not by formatting the axis. Instead, I have a range of cells that link to the dates, with a formula that uses Alt+Enter, like:
Code:
=TEXT(A1,"mmm
yyyy")
I then use this range as the x-axis in the chart.
 
Upvote 0
Thank you. Unfortunately, the nature of the worksheets means that any suggestion of adding another column probably wouldn't go down too well.

The frustrating thing is that there must be an answer, because the sheet I have does it - I just don't know how to replicate it!
 
Upvote 0
Excel 2016 won't accept CTRL-J, but I found a VBA work around.

1. Open the VBA Editor (CTRL+F11)
2. Open the Immediate Window (CTRL-G) if it's not already visible (look for "Immediate" in a title bar)
3. Select your Chart (or some element of it, like the axis) back in the main Excel window
4. In the Immediate window, type (note not case-sensitive) "Debug.print ActiveChart.Axes(xlCategory,xlPrimary).TickLabels.NumberFormat"
5. The current X-Axis number format will be "printed" below the line in the Immediate window.
5. If the resulting string was "mm/dd/yyyy hh:mm:ss AM/PM" (like mine), insert a "vbLf" in the middle, wherever you want the line feed, removing any extra spaces that are being supplanted by the line feed. In my case, like this:
ActiveChart.Axes(xlCategory,xlPrimary).TickLabels.NumberFormat = "mm/dd/yyyy" & vbLf & "hh:mm:ss AM/PM"
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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