Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Bert
 
Posts: n/a
Default validation of times

I have a couple of questions about validating times.
Question 1:
In any cell in Column B, I want to allow valid times in the HH:MM AM/PM
format, plus I want to allow "Noon" and "Midnight". Column B is formatted
for time in the same format (HH:MM AM/PM). I found a validation formula
that does a similar thing for dates, and after playing around for a while, I
came up with this--which I put in the Custom field in the Validation Dialog.
=OR(F2="Noon",F2="Midnight",AND(N(F2)=0,N(F2)<0.9 9999))
It doesn't work, but IF I change the "=" to just "" it works--more or
less; that is, bogus times like 10:70 AM and 13:00 PM are rejected (but not
13:00 w/o the PM, which is fine.).
BUT...I can't enter 12:00 AM (Midnight). And a minor thing: it allows
"noon" and "midnight", but is there a way to force an initial capitalized
letter on each word, e.g., "Noon" and "Midnight"? Now if I enter mIdNighT,
it accepts it. (I tried PROPER and EXACT but w/o success. Maybe there's a
simpler/better way to do this without validation, but I'm not sure how.

Question 2: How do I modify or apply this (or the proper formula, that is),
so that it works for every cell in column B?

Thanks.
Bert


  #2   Report Post  
Biff
 
Posts: n/a
Default

Hi!

Question 1:

You say you want to validate column B but your formula
uses references to column F.

Try this formula to validate column B:

=OR(EXACT(B2,"Noon"),EXACT(B2,"Midnight"),AND
(B2=0,B2<=0.99999))

Question 2:

Select the entire range of cells that you want this
validation to apply to then enter the formula in the box.
The cell references will automatically adjust.

Biff

-----Original Message-----
I have a couple of questions about validating times.
Question 1:
In any cell in Column B, I want to allow valid times in

the HH:MM AM/PM
format, plus I want to allow "Noon" and "Midnight".

Column B is formatted
for time in the same format (HH:MM AM/PM). I found a

validation formula
that does a similar thing for dates, and after playing

around for a while, I
came up with this--which I put in the Custom field in the

Validation Dialog.
=OR(F2="Noon",F2="Midnight",AND(N(F2)=0,N(F2)<0. 99999))
It doesn't work, but IF I change the "=" to just "" it

works--more or
less; that is, bogus times like 10:70 AM and 13:00 PM are

rejected (but not
13:00 w/o the PM, which is fine.).
BUT...I can't enter 12:00 AM (Midnight). And a minor

thing: it allows
"noon" and "midnight", but is there a way to force an

initial capitalized
letter on each word, e.g., "Noon" and "Midnight"? Now if

I enter mIdNighT,
it accepts it. (I tried PROPER and EXACT but w/o

success. Maybe there's a
simpler/better way to do this without validation, but I'm

not sure how.

Question 2: How do I modify or apply this (or the proper

formula, that is),
so that it works for every cell in column B?

Thanks.
Bert


.

  #3   Report Post  
Bert
 
Posts: n/a
Default

Thanks, Biff.
Your formula works perfectly.
Yeah, it's Column B, but I was testing it in Column F and forgot to change
it.
Thanks again.
Bert

"Biff" wrote in message
...
Hi!

Question 1:

You say you want to validate column B but your formula
uses references to column F.

Try this formula to validate column B:

=OR(EXACT(B2,"Noon"),EXACT(B2,"Midnight"),AND
(B2=0,B2<=0.99999))

Question 2:

Select the entire range of cells that you want this
validation to apply to then enter the formula in the box.
The cell references will automatically adjust.

Biff

-----Original Message-----
I have a couple of questions about validating times.
Question 1:
In any cell in Column B, I want to allow valid times in

the HH:MM AM/PM
format, plus I want to allow "Noon" and "Midnight".

Column B is formatted
for time in the same format (HH:MM AM/PM). I found a

validation formula
that does a similar thing for dates, and after playing

around for a while, I
came up with this--which I put in the Custom field in the

Validation Dialog.
=OR(F2="Noon",F2="Midnight",AND(N(F2)=0,N(F2)<0 .99999))
It doesn't work, but IF I change the "=" to just "" it

works--more or
less; that is, bogus times like 10:70 AM and 13:00 PM are

rejected (but not
13:00 w/o the PM, which is fine.).
BUT...I can't enter 12:00 AM (Midnight). And a minor

thing: it allows
"noon" and "midnight", but is there a way to force an

initial capitalized
letter on each word, e.g., "Noon" and "Midnight"? Now if

I enter mIdNighT,
it accepts it. (I tried PROPER and EXACT but w/o

success. Maybe there's a
simpler/better way to do this without validation, but I'm

not sure how.

Question 2: How do I modify or apply this (or the proper

formula, that is),
so that it works for every cell in column B?

Thanks.
Bert


.



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
Validation List and VLookup are ackting strange Jasper Excel Worksheet Functions 1 January 24th 05 01:49 PM
SUMPRODUCT ON TIMES Bob Phillips Excel Worksheet Functions 1 January 13th 05 05:28 PM
Data Validation Window? Ken Excel Discussion (Misc queries) 1 January 11th 05 10:48 PM
list validation using list validation... Patrick G Excel Worksheet Functions 1 December 21st 04 12:37 AM
Excel2K: Is it possible to use dynamic named ranges in custom data validation formula? Arvi Laanemets Excel Discussion (Misc queries) 0 December 2nd 04 11:29 AM


All times are GMT +1. The time now is 12:44 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"