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)

15

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

Setting a Default Table Border Width

When you insert a table into your document, it uses a standard-weight line around each cell in the table. If you want to ...

Discover More

Trouble Recording Paste Special Formula

Sometimes, when you upgrade to a new version of Excel, you could run into a problem recording macros that you had no problem ...

Discover More

Counting Commas in a Selection

If you have a range of cells in which you want to count all the commas, there are several ways you can derive the figure you ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

MORE EXCELTIPS (MENU)

Making Squares

Cells in a worksheet defined by the intersection of rows and columns. If you adjust row height and column width just right, ...

Discover More

Using a Custom Format to Add Dashes

Want some dashes automatically added in values you display in a cell? It may be trickier to develop a custom format than you ...

Discover More

Exporting Latitude and Longitude

A handy way to store latitude and longitude values in Excel is to treat them as regular time values. When it comes around to ...

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 for this tip:

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. 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 two more than 9?

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.

Links and Sharing