Written by Allen Wyatt (last updated April 29, 2023)
This tip applies to Excel 97, 2000, 2002, and 2003
Ciaran works in a library, and often has to work with long lists of ISBN numbers in Excel. The numbers must contain either 10 or 13 digits, may contain dashes, and may have leading zeros. He uses text format for cells containing ISBNs in order to keep them intact as text strings. For some purposes, the dashes in the ISBNs have to be stripped out (he uses Find and Replace for this) and that's where the trouble starts. 0-241-95011-2 becomes 241950112 (now it's dropped to 9 digits), and worse, 978-0-00-200784-9 becomes 9.78E+12 (scientific notation). Ciaran can't find any way of working around these two issues, no matter what he does with formatting before or after using Find and Replace to get rid of the dashes.
What is happening is that when you edit the cells, Excel is parsing the cell contents as numbers instead of as text. In this case, the best solution is to make sure that your cell contents are preceded with an apostrophe before you do the Find and Replace to get rid of the dashes. If you have a worksheet that contains a lot of ISBN numbers in column A, you can add the apostrophes with a formula such as the following:
= "'" & A1
You can then copy the results of the formulas and then use Paste Special to paste values back into column A. Each value in column A will then include the apostrophe. When you later perform the Find and Replace, the leading zeroes will still be present and you won't get any attempts at scientific notation.
The reason this works is because the apostrophe is an indicator to Excel that the cell contents should be treated as text. The apostrophe isn't displayed in the worksheet, but it is part of the cell contents, as you can tell by looking at the Formula bar.
Another approach is to bypass using Find and Replace to get rid of the dashes. Instead use the SUBSTITUTE function to remove them, in this manner:
=SUBSTITUTE(A1,"-","")
The SUBSTITUTE worksheet function returns a text value, so any leading zeroes are maintained and Excel doesn't try to convert the numbers to use a numeric format.
If you routinely need to remove the dashes from a range of cells containing ISBNs, you might be better served to use a macro to do the operation. The following macro works upon whatever cells you've selected before running it.
Sub RemoveDashes() Dim c As Variant, sISBN As String For Each c In Selection sISBN = Application.Substitute(c, "-", "") c.NumberFormat = "@" c.Value = "'" & sISBN Next End Sub
Basically the macro does three things: It removes the dashes, it formats the cell as text, and it places the stripped ISBN back in the cell with an apostrophe before it.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9927) 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: Removing Dashes from ISBN Numbers.
Best-Selling VBA Tutorial for Beginners Take your Excel knowledge to the next level. With a little background in VBA programming, you can go well beyond basic spreadsheets and functions. Use macros to reduce errors, save time, and integrate with other Microsoft applications. Fully updated for the latest version of Office 365. Check out Microsoft 365 Excel VBA Programming For Dummies today!
Excel is usually more flexible in what you can reference in formulas than is immediately apparent. This tip examines some ...
Discover MoreIn 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 ...
Discover MorePostal codes in Canada consist of six characters, separated into two groups. This tip explains the format and then shows ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments