You are here:

Excel/force/control number/dashes format


I'm using MS Windows 7 Enterprise SP1 and MS Office 2010.  I have a column of numbers using this format ##-8-#####-#.  I tried custom formatting and conditional formatting without success.  I need to keep the data entry user from entering any number that is longer or shorter.  And the hyphens/dashes have to be exactly where they are.  And the "8" in my example always has to be an 8.  Thanks in advance for any help.

I'm slightly confused as you refer to numbers with a custom format, and then to dashes - IF the numbers ARE numbers with a standard format, then the only bit to check is the position of the 8.  But I'm guessing you need the data entered as text - if so, using A2 as an example, you need to use data validation to fix this (data ribbon, then the data tools section) - enter this custom formula (I think I counted the length correctly but amend if not)

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Aidan Heritage


I have provided first hand support since `95 for Microsoft Office majoring in Word and Excel - support for all versions from 2 onwards. I'm based in the UK, so please allow for time differences when asking me questions from other parts of the world!


My background is in the insurance industry and call centre areas, but have been called upon to provide many varied solutions.

I'm educated to UK A level standard, but as I left school some 30 years ago that is rather irrelevent - university of life has provided more of a background!

©2017 All rights reserved.