Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Custom Validation formula for business rules

I'm putting business rules as validation criteria in a spreadsheet. These
cells contain dates and the rules a
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((I7H7),month(I7)=month(H7),year(I7)=year(H7) ,i7(month(G7),day(G7),year(G7)+21))

Got any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 913
Default Custom Validation formula for business rules

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 a
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((I7H7),month(I7)=month(H7),year(I7)=year(H7 ),i7(month(G7),day(G7),year(G7)+21))

Got any suggestions?



Try this formula:

=AND((I7H7),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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Custom Validation formula for business rules

the 3rd MONTH has a bracket on the left without having a closing bracket


=AND( (I7H7) , _
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" wrote in message
.. .
I'm putting business rules as validation criteria in a spreadsheet. These
cells contain dates and the rules a
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((I7H7),month(I7)=month(H7),year(I7)=year(H7) ,i7 (
month(G7),day(G7),year(G7)+21))

Got any suggestions?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default Custom Validation formula for business rules

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 a
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((I7H7),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
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 do I set up a validation rules with two data rules Trudy Excel Worksheet Functions 1 October 16th 06 05:42 AM
Data Validation Rules Louise Excel Worksheet Functions 6 May 10th 06 01:02 PM
Validation rules base on formula on other cell Souris Excel Programming 0 August 20th 05 04:17 PM
Validation rules Souris Excel Programming 3 August 19th 05 08:09 PM
Exceptions to Validation Rules Jim Johnson Excel Worksheet Functions 5 November 7th 04 01:04 PM


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