Using an En Dash, by Default

Written by Allen Wyatt (last updated August 9, 2021)
This tip applies to Word 2007, 2010, 2013, and 2016


1

The style guide Phil follows stipulates that when indicating ranges of numbers (such as 1—9 or 23—36), an en dash should be used rather than a hyphen. Phil wonders if there is a way to force Word to do this automatically.

There are a couple of ways you can put the en dash between your number ranges. The "automatic" way (as far as Word is concerned) is to surround your hyphen by spaces. In other words, let's say that your range is something like 23—45. All you need to do is type 23, space, hyphen, space, and then 45. The moment you type a space or a punctuation mark after "45," the hyphen is transformed, automatically, into an en dash.

Using this approach, while handy, leaves the spaces before and after the en dash, which may run afoul of your style guide. If it does, you can always use Find and Replace to get rid of any spaces before and after en dashes. Or, you could simply bypass the automatic method and learn to type your own en dashes. The easiest way is to simply press Ctrl and press the minus key on the numeric keypad. (It has to be on the numeric keypad.) Word inserts the en dash lickety-split.

You can also use Word's Find and Replace tool to change all hyphens to en dashes. Here's how:

  1. Press Ctrl+H. Word displays the Replace tab of the Find and Replace dialog box.
  2. Click the More button, if it is available. (See Figure 1.)
  3. Figure 1. The Replace tab of the Find and Replace dialog box.

  4. Make sure the Use Wildcards check box is selected.
  5. Enter the following in the Find What box: ([0—9])-([0—9])
  6. Enter the following in the Replace With box: \1^=\2
  7. Click Replace All.

These steps replace any digit followed by a hyphen and then another digit with the original digit followed by an en dash followed by the original digit. Unfortunately, it won't perform the replacement if the hyphen is preceded or followed by a space. If your text includes such errant spaces, you'll need to get rid of them before the above will work properly.

Or, you can use a macro that will do all the permutations of Find and Replace for you. The following macro actually invokes Find and Replace seven times, with the result being that any range that contains any permutation of hyphen or en dash surrounded by single spaces will be converted to digits surrounding a single en dash.

Sub FixNumberRanges()
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "([0-9])-([0-9])"
        .Replacement.Text = "\1^=\2"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False

        .Execute Replace:=wdReplaceAll

        .Text = "([0-9]) -([0-9])"
        .Execute Replace:=wdReplaceAll

        .Text = "([0-9])- ([0-9])"
        .Execute Replace:=wdReplaceAll

        .Text = "([0-9]) - ([0-9])"
        .Execute Replace:=wdReplaceAll

        .Text = "([0-9]) ^=([0-9])"
        .Execute Replace:=wdReplaceAll

        .Text = "([0-9])^= ([0-9])"
        .Execute Replace:=wdReplaceAll

        .Text = "([0-9]) ^= ([0-9])"
        .Execute Replace:=wdReplaceAll
    End With
End Sub

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (5133) applies to Microsoft Word 2007, 2010, 2013, and 2016.

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

Pulling All Fridays

It can be handy to know when specific weekdays occur within a range of dates. Figuring out this information, using ...

Discover More

Putting the Control Panel on the Desktop

The desktop is designed to hold all your most commonly accessed programs, files, and folders. If you access the Control ...

Discover More

Sheets for Months

One common type of workbook used in offices is one that contains a single worksheet for each month of the year. If you ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Talking to Yourself

Need to keep notes about a document, but you don't want others to see those notes either on-screen or on-paper? Here's an ...

Discover More

Inserting Dashes between Letters in Words

Sometimes typing isn't straight typing. Sometimes you need to perform special tasks, such as putting dashes between ...

Discover More

Quickly Deleting Words

Tired of pressing the Delete or Backspace key for every character you want to delete? Here's a way you can make your ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, 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}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. 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 nine more than 7?

2021-08-09 07:41:56

Malcolm Patterson

The macro addresses only ranges of numbers, which is far and away the most common type of range. However, it should come with two caveats. First, the macro does not address ranges of days (Monday-Friday), months (June-August), or other ranges expressed with letters instead of numerals. For these, an en dash is still appropriate. Second, there are some hyphens that should not be converted to en dashes, for example, in document numbers, hyphens should normally be replaced with nonbreaking hyphens rather than en dashes (there are publishers that use both in a single document number, e.g., ASME). Users with more complicated hyphenation problems may be better served by a third-party application like PerfectIt.


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, 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.