LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35
Default Data Validation

I'm having some difficulty on my data validation...

I need to validate that a number entered into a cell is:
9 characters wide
9 numbers (123456789, 012345678, etc.)
OR
Starts with an E and has 8 numbers after it (E12345678, E01234567, etc.)

Here's my validation formula:
=OR(AND(TYPE(A2)=2,LEFT(A2,1)="e",TYPE(RIGHT(A2,8) =1),LEN(A2)=9),AND(TYPE(A2)=1,LEN(A2)=7,LEN(A2)<= 9))

Now, from what I've read here on the board, this should be working if all of
these are true:
TYPE(A2)=2 'cell is text
LEFT(A2,1)="e" 'starts with an e
TYPE(RIGHT(A2,8)=1) 'ends in 0 numbers
LEN(A2)=9 'total length is 9 characters
OR
TYPE(A2)=1 'entire value is a number
LEN(A2)=7 'cell has at least 7 digits
LEN(A2)<=9 'cell has no more than 9 digits
'these last two lines are for SSN's that can begin with 00. There should be
no SSN's that start with 000.

For some reason, I can enter e1a345678 and it takes that value, not picking
up that while it starts with an e, it doesn't have 8 numbers following it.
It DOES however pick up a12345678 as an error since it doesn't start with an
e.

I did some troubleshooting...putting the right 8 characters of a2 in a cell
(=RIGHT(A2,8)) and when I try to 'type' that cell, it comes back as text
instead of numbers, even though it contains '12345678'. Any idea why this is?

THX guys!
 
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
Validation Data using Validation Table cell range..... Dermot Excel Discussion (Misc queries) 16 January 5th 10 09:35 PM
data validation invalid in dynamic validation list ilia Excel Discussion (Misc queries) 0 November 7th 06 12:54 PM
data validation invalid in dynamic validation list ilia Excel Worksheet Functions 0 November 7th 06 12:54 PM
Data validation with validation lists and combo boxs Keith Excel Discussion (Misc queries) 1 October 12th 06 11:08 AM
Refresh existing data when changed in data validation list problem girl New Users to Excel 1 September 28th 05 10:19 PM


All times are GMT +1. The time now is 04:40 PM.

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

About Us

"It's about Microsoft Excel"