Written by Allen Wyatt (last updated April 13, 2024)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021
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:
Figure 1. The Replace tab of the Find and Replace dialog box.
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 that when you run the macro, all changes are made without pause. Be aware that there may be some hyphens you don't want replaced, such as those within URLs or those that are part of math formulas. If your documents have exceptions to what you need replaced, then you'll either need to change the macro to account for those exceptions, or just go with the manual Find and Replace which allows you to step through each potential change and determine if it should be made.
Note:
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, 2016, 2019, Word in Microsoft 365, and 2021.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
One way to help improve your writing is to minimize the number of duplicated words you use in your prose. Depending on ...
Discover MoreThe traditional way to insert symbols into a document is to use the Symbol dialog box. This tip looks at ways other than ...
Discover MoreIf you use justified paragraphs, you know that if you press Shift+Enter, it can lead to some odd spacing between words ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2024-04-17 04:00:15
Robert Love
@Paul: Yes, that en dash you typed on a line by itself is definitely an en dash in my browser. I still think there is something going on that needs explaining. In Allen's text it appears that en dash has been systematically replaced by em dash throughout. It would be nice if Allen could notice this conversation and offer a comment.
2024-04-16 09:13:38
Paul Stregevsky
"I see that Paul's comment too contains an em dash where he presumably typed an en dash. Is this website changing what people type in?!"
I'm a stickler for distinguishing my ens from my ems, so I don't know what went wrong. I used my custom keyboard shortcut Control-N to enter an en dash in Outlook; then I pasted it into the web form on this page. I haven't even created a similar shortcut (Control-M) for inserting an em dash. So I don't know what went wrong. Next time I'll copy and paste from a website. In fact, let's see how it renders when I copy and paste an actual rendered en dash from a page that provides the HTML code for that character only :
–
OK, that looks like an en, not an em, in my draft. Here goes...
2024-04-16 04:17:01
Robert Love
I see that Paul's comment too contains an em dash where he presumably typed an en dash. Is this website changing what people type in?!
Regarding auto-correct et al., my version of Word has an option in Autoformat-as-you-type that replaces two hyphens by an en-dash, and this seems to be enabled by default. Which presumably means that many users be default have two easy ways to type an en dash: either that, or the CTRL+minus shortcut I mentioned before. The two-hyphens convention should be fairly well known: I think quite a few other word processing and editing tools support it (Atlassian Confluence, for example). I've also worked on projects where an Auto-correct was created to convert three hyphens to an em dash.
2024-04-15 11:56:40
Paul Stregevsky
When I use an en dash, it's seldom to define a range of numbers. More often, it's to denote that two ideas are corollary.
For example, I'll write African—American relations when I mean relations between Africa and America. If instead I wrote African-American relations, many readers would wrongly think I mean relations between African Americans and White Americans.
Other times, I'll use an en dash to fuse a pair of phrases or multiword names:
A United States—United Arab Emirates Alliance. Yes, in this case, I could have written U.S/UAR, but I prefer to use the slash mark to connote contrast or difference ("Yes/No").
2024-04-15 10:28:21
Andrew
I "love" what Robert said (tee hee). How else do you distinguish between hyphens that should remain hyphens between digits (social security numbers, dates, phone numbers, etc.) and hyphens that should denote a range of numbers? These are semantic (and not just textual) differences, so I've just taught myself to type the code for the en-dash.
Andy.
2024-04-15 04:03:19
Robert Love
This tip muddies the waters somewhat by using an em dash instead of an en dash in the text.
None of this trouble would be necessary if you would simply type an en dash instead of a hyphen when creating your text. It's not as if that's hard to do. You can easily insert an en dash with CTRL+minus, where the minus is the one on the numeric keypad.
2024-04-13 09:32:28
Steven Wilhelm
I've used a different approach for years. I use AutoCorrect to insert an en dash when I type n- (that is, n hyphen). I use a similar approach to get an em dash, typing m- (that is, m hyphen).
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments