Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Formula to check against a list of valid values

I am importing data into a spreadsheet. I want to check whether certain
columns contain valid data. So if columns A and D, for instance, need to be
"character", I would want to check that the value in any given field is A-Z
or a-z. Is there a quicker way than using "OR" and typing out the 52
possibilities?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Formula to check against a list of valid values

One way:

=AND(LEN(A1)=1,OR(CODE(A1)=MEDIAN(CODE(A1),97,122) ,CODE(A1)=MEDIAN(CODE(A1),65,90)))


--
Biff
Microsoft Excel MVP


"Barb W" <Barb wrote in message
...
I am importing data into a spreadsheet. I want to check whether certain
columns contain valid data. So if columns A and D, for instance, need to
be
"character", I would want to check that the value in any given field is
A-Z
or a-z. Is there a quicker way than using "OR" and typing out the 52
possibilities?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Formula to check against a list of valid values

Okay, so this is an amazing formula! Unfortunately, it doesn't quite work
for me. It appears to depend on only having a single character in the field.
My original post wasn't very clear, but I need to check a column (several
different columns, actually) which could be variable length, to ensure all
the characters are in the valid range.

So, "ABC" or "AbCDefg" would be valid, but "AB^m" would not be.



"T. Valko" wrote:

One way:

=AND(LEN(A1)=1,OR(CODE(A1)=MEDIAN(CODE(A1),97,122) ,CODE(A1)=MEDIAN(CODE(A1),65,90)))


--
Biff
Microsoft Excel MVP


"Barb W" <Barb wrote in message
...
I am importing data into a spreadsheet. I want to check whether certain
columns contain valid data. So if columns A and D, for instance, need to
be
"character", I would want to check that the value in any given field is
A-Z
or a-z. Is there a quicker way than using "OR" and typing out the 52
possibilities?




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Formula to check against a list of valid values

Try this:

=SUMPRODUCT(LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),CHAR(ROW(INDIRECT("65:90" ))),"")))=LEN(A1)



--
Biff
Microsoft Excel MVP


"Barb W" wrote in message
...
Okay, so this is an amazing formula! Unfortunately, it doesn't quite work
for me. It appears to depend on only having a single character in the
field.
My original post wasn't very clear, but I need to check a column (several
different columns, actually) which could be variable length, to ensure all
the characters are in the valid range.

So, "ABC" or "AbCDefg" would be valid, but "AB^m" would not be.



"T. Valko" wrote:

One way:

=AND(LEN(A1)=1,OR(CODE(A1)=MEDIAN(CODE(A1),97,122) ,CODE(A1)=MEDIAN(CODE(A1),65,90)))


--
Biff
Microsoft Excel MVP


"Barb W" <Barb wrote in message
...
I am importing data into a spreadsheet. I want to check whether certain
columns contain valid data. So if columns A and D, for instance, need
to
be
"character", I would want to check that the value in any given field is
A-Z
or a-z. Is there a quicker way than using "OR" and typing out the 52
possibilities?






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
How to valid the values? Eric Excel Worksheet Functions 10 August 26th 07 05:43 AM
Formula to check duplicated values Mary Excel Discussion (Misc queries) 2 March 2nd 07 01:46 PM
How to check valid Date value? hstijnen Excel Worksheet Functions 1 August 14th 06 01:25 PM
Formula to Check Values between to variables John Excel Worksheet Functions 2 February 28th 06 10:30 PM
How do I check for values in a list in an if statement? DJC Excel Discussion (Misc queries) 1 July 27th 05 07:13 PM


All times are GMT +1. The time now is 07:08 AM.

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"