Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Creating Two-Line Custom Formats.

Creating Two-Line Custom Formats

by Allen Wyatt
(last updated September 15, 2016)

16

Excel is quite flexible in how it allows you to set up custom formats for displaying all sorts of values. Most custom formats are straightforward and easy to figure out, once you understand how custom formats work. (Custom formats and how to set them up has been discussed fully in other issues of ExcelTips.)

What if you want to create a two-line custom format, however? For instance, you may want to format a date so that the abbreviated day of the week and day of the month is on the first line, followed by the unabbreviated name of the month on the second line. Using such a format, a date would appear in a single cell in this manner:

Sat 4
March

Most of this can be done by the custom format "ddd d mmmm", but you need to figure out a way to add a line break between the "d" and the "mmmm". Excel won't let you press Alt+Enter between them, which is what you normally do to add a line break.

The solution is to use the numeric keypad to enter the desired line break in the format. Follow these steps to set it up:

  1. Select the cells you want to format.
  2. Choose Cells from the Format menu. Excel displays the Number tab of the Format Cells dialog box.
  3. In the Category list, choose Custom. (See Figure 1.)
  4. Figure 1. The Number tab of the Format Cells dialog box.

  5. Delete whatever is in the Type box.
  6. Type "ddd d" without the quote marks.
  7. Hold down the Alt key while you press 0010 on the numeric keypad. This enters the line feed character, and it looks like the portion of the format you typed in step 5 disappears. It is not really gone; it has just moved up above what can be displayed in the Type box.
  8. Type "mmmm" without the quote marks.
  9. Click the Alignment tab. (See Figure 2.)
  10. Figure 2. The Alignment tab of the Format Cells dialog box.

  11. Make sure the Wrap Text check box is selected.
  12. Click OK.

After setting up the format in this manner, you will need to adjust the row height of the formatted cells so that the entire two lines of the date will display.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2895) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Creating Two-Line Custom Formats.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Returning the Smallest Non-Zero Value

In a series of values you may need to know the smallest value that isn't a zero. There is no built-in function to do this, ...

Discover More

Averaging the Last Numbers in a Column

Need to calculate a running average for the last twelve values in a constantly changing range of values? The formula ...

Discover More

Pulling Headers and Footers from Other Files

You may have some standard headers and footers you want to make available in your document templates. This tip describes some ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (menu)

Shortcut to Merge Cells

Need to merge a bunch of cells together on a regular basis? You'll love the two macros in this tip which can make short work ...

Discover More

Understanding Cell Indenting

Formatting a cell could, if you desire, also include the indentation of information within the cell. This tip examines what ...

Discover More

Formatting for Hundredths of Seconds

When you display a time in a cell, Excel normally displays just the hours, minutes, and seconds. If you want to display the ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 8Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 5 + 0?

2017-06-12 15:36:00

Kapil Gupta

Use Ctl+J instead.
http://datapigtechnologies.com/blog/index.php/forcing-carriage-return-in-custom-date-format/


2017-01-24 14:14:05

chepox

@Peter Lunde - I wrote this comment below a while ago for previous version of Excel. Just tried it for v2013 in Windows and it still works. Give it a try.

"You need to uncheck wrap text for the selected cell then select shrink to fit, afterwards, check wrap text back again. Now you can shrink the columns to the actual size of the text per line."


2017-01-23 14:25:04

Peter Lunde

I tried this with Ddd[Alt 0010]d but my cells display ###### when I make them less than 6 characters wide. It is, as if, Excel thinks all the characters are in a single row.


2017-01-13 15:38:36

Diane

Good morning!

I'm trying to do this in Google Sheets. Do you have a suggestion on how to make it work?

Thanks!

Diane


2016-06-23 09:23:42

Poser2662

This worked PERFECTLY!!!!! Thank you!


2015-10-20 11:19:50

Thomas

Hello, I have been looking for a solution to this for a long time. But could you be a little more clear on this? May be do a video?

"Type "ddd d" without the quote marks.
Hold down the Alt key while you press 0010 on the numeric keypad. This enters the line feed character, and it looks like the portion of the format you typed in step 5 disappears. It is not really gone; it has just moved up above what can be displayed in the Type box.
Type "mmmm" without the quote marks."


2015-09-20 03:20:47

Ken

I received an audible error when I tried pressing "Alt" and entering numbers in the "Type:" field under custom number format.I was only able to get this to work by turning on "Num Lock" and using the numbers under the letters. I do not have a full keyboard. I only have the numbers at the top (not a separate set of numbers/keypad on the right.)


2015-03-25 15:33:07

Mitch

After Paula commented, I went back and tried chepox's simple instructions.

This time it worked -- hurrah!
I may not have executed his/her instructions properly earlier.

So I'm a happier camper now.

Thanks everyone.


2015-03-24 13:42:14

Paula

This worked perfectly for me once I came back and read the bit about shrink fit! Thanks!


2015-03-06 06:38:59

Carlos

What chepox wrote worked for me!

Thanks


2014-10-08 09:21:47

Mitch

Chepox and Michael,

Thanks for your helpful comments.

But after following them closely, they still don't allow me to shrink the column to actual width of the custom-format-wrapped text.

I get the usual unfriendly "########" display when shrinking the column even a tiny bit past the auto-shrinked width.

So the column still remains considerably wider than it needs to be.

I'm using Excel 2010 in Windows 7.

Thanks everyone.


2014-10-07 13:20:45

chepox

Mitch,
You need to uncheck wrap text for the selected cell then select shrink to fit, afterwards, check wrap text back again. Now you can shrink the columns to the actual size of the text per line.


2014-08-07 07:53:22

Michael (Micky) Avidan

@mitch,
It is very easy to define a small Event-Macro to AutoFit the column.
Assuming you are dealing with Columns A,B,C - all you ned is to type the following macro into the Sheet Module:
****************
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target.Columns, Columns("A:C")) Is Nothing Then Exit Sub
Target.Columns.AutoFit
End Sub
*********
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
ISRAEL


2014-08-06 11:41:51

mitch

This tip gives a "line feed" (as "advertised") but the width the column needs to display the text is still the same (I'm using Excel 2010)

Thus, one cannot use this method to reduce the width of a column (a prime motivator for wrapping text).

thanks


2013-07-14 08:10:18

Michael (micky) Avidan

@ machados soares,

Portable Computers have a special Fn key (usually in Blue) which toggles 10 keys on the keyboard to behave as the similar to the "Num Pad".

Ask your support dept. and/or check the Portable User guide/Manual.

Michael Avidan
“Microsoft®” MVP – Excel
ISRAEL


2013-07-13 11:09:20

machados soares

This tip doens't work on my portable.
I have windows 7 and excl xlsx.
I do everything inicated on the tip but it doens,t work.
Coul you help me please?


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.