trying to add date validation to existing formula

fingermouse

Board Regular
Joined
Dec 13, 2013
Messages
117
Hi,


as per the title, I have created a formula which does the following:

• results in 'pass' if either 'PAS2030:2014' or 'PAS2030:2017' is entered in Q2

• results in 'n/a' - PAS exception' if 'n/a' is entered in Q2

• results in 'fail - invalid' if anything other than the above is entered in Q2

• results in 'fail - blank' if AR2 is blank

This is the formula:

Code:
=IF(ISBLANK('Data Area'!AR2),"Fail - Measure Type is blank",IF(ISNA(MATCH('Data Area'!AR2,PAS_Exception_Measures,0)),IF(OR('Data Area'!Q2="PAS2030:2014",'Data Area'!Q2="PAS2030:2017"),"Pass",IF(OR('Data Area'!Q2="N/A"),"N/A - PAS Exception",IF(ISBLANK('Data Area'!Q2),"Fail - PAS is blank","Fail - PAS Invalid")))))

The above works perfectly. However i want to extend the formula by adding date validation but don't know exactly how or where to place it in the formula. This is what I need:

If the user enters 'PAS2030:2014' in Q2 but also enters a date less than 01/06/17 in another cell (AL2) then this results in "Fail - a DOCI after 31/05/17 must use PAS2030:2017"

I'm guessing this part of the formula should be something like this:

Code:
=IF(AND(VALUE('Data Area'!AL2)<42887,"Fail - a DOCI after 31/05/17 must use PAS2030:2017"))

But I don't know how to place it into the existing formula. How could this be done? Please help!! Thanks, Cal
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
why not just make the second formula be the first part of the original code?

=IF(AND(VALUE('Data Area'!AL2)<42887,"Fail - a DOCI after 31/05/17 must use PAS2030:2017")),IF(ISBLANK('Data Area'!AR2),"Fail - Measure Type is blank",IF(ISNA(MATCH('Data Area'!AR2,PAS_Exception_Measures,0)),IF(OR('Data Area'!Q2="PAS2030:2014",'Data Area'!Q2="PAS2030:2017"),"Pass",IF(OR('Data Area'!Q2="N/A"),"N/A - PAS Exception",IF(ISBLANK('Data Area'!Q2),"Fail - PAS is blank","Fail - PAS Invalid"))))))
 
Upvote 0
why not just make the second formula be the first part of the original code?

=IF(AND(VALUE('Data Area'!AL2)<42887,"Fail - a DOCI after 31/05/17 must use PAS2030:2017")),IF(ISBLANK('Data Area'!AR2),"Fail - Measure Type is blank",IF(ISNA(MATCH('Data Area'!AR2,PAS_Exception_Measures,0)),IF(OR('Data Area'!Q2="PAS2030:2014",'Data Area'!Q2="PAS2030:2017"),"Pass",IF(OR('Data Area'!Q2="N/A"),"N/A - PAS Exception",IF(ISBLANK('Data Area'!Q2),"Fail - PAS is blank","Fail - PAS Invalid"))))))

Hi Roderick,

Many thanks for responding to my post - if i cut and paste your solution into the cell i get a 'the formula you typed contains an error' :(
 
Upvote 0
Hi Roderick,

Many thanks for responding to my post - if i cut and paste your solution into the cell i get a 'the formula you typed contains an error' :(

Dang, sorry. It's difficult to test since you have some named ranges and such. Maybe:
=IF(AND(VALUE('Data Area'!AL2)<42887,"Fail - a DOCI after 31/05/17 must use PAS2030:2017")),IF(ISBLANK('Data Area'!AR2),"Fail - Measure Type is blank",IF(ISNA(MATCH('Data Area'!AR2,PAS_Exception_Measures,0)),IF(OR('Data Area'!Q2="PAS2030:2014",'Data Area'!Q2="PAS2030:2017"),"Pass",IF(OR('Data Area'!Q2="N/A"),"N/A - PAS Exception",IF(ISBLANK('Data Area'!Q2),"Fail - PAS is blank","Fail - PAS Invalid")))))))
 
Upvote 0
<date(2017,6,1),q2="pas2030:2014"),"fail -="" a="" doci="" after="" 31="" 05="" 17="" ,must="" use="" pas2030:2017","something="" else")
</date(2017,6,1),q2="pas2030:2014"),"fail>
 
Last edited:
Upvote 0
Just the same error as before, windows popup 'the formula you typed contains an error'

If I click the fx button next to the formula bar, there's a #VALUE! error in the Logical2 argument box
 
Upvote 0
Ok, I assumed your second code was tested. It would not have worked. Try this one

Code:
=IF(AND(ISNUMBER(AL2),AL2<42887),"Fail - a DOCI after 31/05/17 must use PAS2030:2017",[COLOR=#333333]IF(ISBLANK('Data Area'!AR2),"Fail - Measure Type is blank",IF(ISNA(MATCH('Data Area'!AR2,PAS_Exception_Measures,0)),IF(OR('Data Area'!Q2="PAS2030:2014",'Data Area'!Q2="PAS2030:2017"),"Pass",IF(OR('Data Area'!Q2="N/A"),"N/A - PAS Exception",IF(ISBLANK('Data Area'!Q2),"Fail - PAS is blank","Fail - PAS Invalid")))))[/COLOR])
 
Upvote 0
Hi Roderick,

Brilliant!! Thanks for taking the time to help me, its really appreciated.

Your formula worked great, many thanks. However, I messed up with the logic (sorry) and realised that I needed date validation which depended on whether the user entered 'PAS2030:2014' or 'PAS2030:2017'.

so i played about with it and came up with this solution....

Code:
=IF('Data Area'!Q2="PAS2030:2014",(IF(AND(ISNUMBER('Data Area'!AL2),'Data Area'!AL2>42886),"Fail - a DOCI after 31/05/17 must use PAS2030:2017","Pass")),IF(ISBLANK('Data Area'!AR2),"Fail - Measure Type is blank",IF(ISNA(MATCH('Data Area'!AR2,PAS_Exception_Measures,0)),IF(OR('Data Area'!Q2="PAS2030:2014",'Data Area'!Q2="PAS2030:2017"),"Pass",IF(OR('Data Area'!Q2="N/A"),"N/A - PAS Exception",IF(ISBLANK('Data Area'!Q2),"Fail - PAS is blank","Fail - PAS Invalid"))))))

I wouldn't have managed without your help - thanks again!
 
Upvote 0

Forum statistics

Threads
1,216,095
Messages
6,128,800
Members
449,468
Latest member
AGreen17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top