PC Review


Reply
Thread Tools Rate Thread

Custom Validation formula for business rules

 
 
salgud
Guest
Posts: n/a
 
      14th Jul 2009
I'm putting business rules as validation criteria in a spreadsheet. These
cells contain dates and the rules are:
1. The value in I7 is greater than H7
2. The month of I7 must be the same as H7
3. The year of I7 must be the same as H7
4. I7 can not be more than 21 years later then G7
Excel tells me there's an error in the following formula, which I can't
find:
=and((I7>H7),month(I7)=month(H7),year(I7)=year(H7),i7>(month(G7),day(G7),year(G7)+21))

Got any suggestions?
 
Reply With Quote
 
 
 
 
Lars-Åke Aspelin
Guest
Posts: n/a
 
      14th Jul 2009
On Tue, 14 Jul 2009 11:25:08 -0600, salgud <(E-Mail Removed)>
wrote:

>I'm putting business rules as validation criteria in a spreadsheet. These
>cells contain dates and the rules are:
>1. The value in I7 is greater than H7
>2. The month of I7 must be the same as H7
>3. The year of I7 must be the same as H7
>4. I7 can not be more than 21 years later then G7
>Excel tells me there's an error in the following formula, which I can't
>find:
>=and((I7>H7),month(I7)=month(H7),year(I7)=year(H7),i7>(month(G7),day(G7),year(G7)+21))
>
>Got any suggestions?



Try this formula:

=AND((I7>H7),MONTH(I7)=MONTH(H7),YEAR(I7)=YEAR(H7),I7<=DATE(YEAR(G7)+21,MONTH(G7),DAY(G7)))

Note the change from > to <= in the last comparison.

Hope this helps / Lars-Åke
 
Reply With Quote
 
Patrick Molloy
Guest
Posts: n/a
 
      14th Jul 2009
the 3rd MONTH has a bracket on the left without having a closing bracket


=AND( (I7>H7) , _
MONTH(I7)=MONTH(H7) , _
YEAR(I7)=YEAR(H7) ,
_
>>>>this looks wrong >>>> I7 > MONTH(G7), DAY(G7), YEAR(G7)+21)


as it is, the last part doesn't make sense

"salgud" <(E-Mail Removed)> wrote in message
news:1wccnb7ls2a0n$.(E-Mail Removed)...
> I'm putting business rules as validation criteria in a spreadsheet. These
> cells contain dates and the rules are:
> 1. The value in I7 is greater than H7
> 2. The month of I7 must be the same as H7
> 3. The year of I7 must be the same as H7
> 4. I7 can not be more than 21 years later then G7
> Excel tells me there's an error in the following formula, which I can't
> find:


=and((I7>H7),month(I7)=month(H7),year(I7)=year(H7),i7> (
month(G7),day(G7),year(G7)+21))
>
> Got any suggestions?


 
Reply With Quote
 
salgud
Guest
Posts: n/a
 
      14th Jul 2009
On Tue, 14 Jul 2009 11:25:08 -0600, salgud wrote:

> I'm putting business rules as validation criteria in a spreadsheet. These
> cells contain dates and the rules are:
> 1. The value in I7 is greater than H7
> 2. The month of I7 must be the same as H7
> 3. The year of I7 must be the same as H7
> 4. I7 can not be more than 21 years later then G7
> Excel tells me there's an error in the following formula, which I can't
> find:
> =and((I7>H7),month(I7)=month(H7),year(I7)=year(H7),i7>(month(G7),day(G7),year(G7)+21))
>
> Got any suggestions?


Thanks to both of you for the help. Got it working great!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data validation custom formula =?Utf-8?B?SklDREI=?= Microsoft Excel Worksheet Functions 1 7th May 2007 03:44 PM
Custom Validation Rules TonyB Microsoft Access Database Table Design 6 20th Jan 2005 11:43 AM
Data Validation-Custom formula =?Utf-8?B?Q2FybCBOaWNob2xzb24=?= Microsoft Excel Misc 1 14th Jul 2004 11:13 AM
IF formula with VALIDATION Rules LSTOOPS Microsoft Excel Worksheet Functions 2 5th Jan 2004 04:48 PM
Custom validation with formula Hardy Microsoft Excel Misc 2 27th Nov 2003 09:49 AM


Features
 

Advertising
 

Newsgroups
 


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