Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Rusty
 
Posts: n/a
Default Constrain data format in cell

I'm not sure this is the proper terminology for what I want to do, so let me
give an example. Let's say I have a phone number field that I want to have
formatted as (xxx) yyy-zzzz and I want this to be required in the field, or a
message box will pop up instructing the user for correct input. Or, a zip
code field to have either 5 digits or xxxxx-yyyy (5+4) digits, again
prompting if the data doesn't meet the criteria.

I know it can be done in Access, but I can't figure it out in Excel. Is
there an easy way to do it? I don't want to write code (I DON'T write code)
and I certainly can't teach others to write code when they need (want) to do
something like this.

Thanks in advance!

  #2   Report Post  
Posted to microsoft.public.excel.misc
Sloth
 
Posts: n/a
Default Constrain data format in cell

I will usually enter phone numbers as a number (ie 1234567890) and use a
custom number format of
(000) 000-0000
this will make the numbers look like phone numbers (ie (123) 456-7890). You
can then use data validation and choose "text length" and "equal to" and put
10 as the text length. This should be okay because phone numbers never have
a 0 as the first digit (you won't be able to enter 0123456789 as a number).

If you want them to enter the number with the parenthesis then format the
cell as text and use a custom data validation formula of
=(FIND("(",A1)=1)*(FIND(") ",A1)=5)*(FIND("-",A1)=10)
This will ensure that they enter a number as
(123) 456-7890

zipcodes can be done in a similar fashion.


"Rusty" wrote:

I'm not sure this is the proper terminology for what I want to do, so let me
give an example. Let's say I have a phone number field that I want to have
formatted as (xxx) yyy-zzzz and I want this to be required in the field, or a
message box will pop up instructing the user for correct input. Or, a zip
code field to have either 5 digits or xxxxx-yyyy (5+4) digits, again
prompting if the data doesn't meet the criteria.

I know it can be done in Access, but I can't figure it out in Excel. Is
there an easy way to do it? I don't want to write code (I DON'T write code)
and I certainly can't teach others to write code when they need (want) to do
something like this.

Thanks in advance!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
data in cell not corresponding with entry Graeme New Users to Excel 1 December 21st 05 04:16 PM
Cell Format Changes When Data Is Entered - Not Conditional Formatt SundanceKidLudwig Excel Worksheet Functions 2 September 30th 05 02:07 PM
can't format cell - have tried unlocking and unprotecting griffin Excel Discussion (Misc queries) 1 April 5th 05 02:11 AM
Cannot Format Data in Cell Karen Excel Discussion (Misc queries) 4 March 25th 05 03:54 AM
format cell data to display stacked data dkay10 Excel Discussion (Misc queries) 1 January 17th 05 02:20 AM


All times are GMT +1. The time now is 03:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"