ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   format cells not to except dashes (https://www.excelbanter.com/excel-discussion-misc-queries/57754-format-cells-not-except-dashes.html)

kclover

format cells not to except dashes
 
I am trying to format a range of cells not to except dashes (-) ie. when
entering phone numbers 123-123-1234

JE McGimpsey

format cells not to except dashes
 
Format is a display function only, it doesn't affect how entries are
parsed (I assume you mean "accept").

You can use validation. Select your range (I'll assume that A1 is the
active cell). Choose Data/Validation/Allow:Custom with the formula

=ISERR(FIND("-",A1))



In article ,
"kclover" wrote:

I am trying to format a range of cells not to except dashes (-) ie. when
entering phone numbers 123-123-1234


Ron Coderre

format cells not to except dashes
 
Try this:
Using cell A1
Set the numbe format to Special and select Phone Number

Then:
DataData Validation
Allow: Custom
Formula: =ISERROR(FIND("-",A1))

If length is an issue:
Use this validation formula instead:
=AND(LEN(A1)=10,ISERROR(FIND("-",A1)))

Does that give you something to work with?

***********
Regards,
Ron


"kclover" wrote:

I am trying to format a range of cells not to except dashes (-) ie. when
entering phone numbers 123-123-1234



All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com