Custom Data Validation Formula not working

laxminarayana

Board Regular
Joined
Nov 16, 2013
Messages
56
I am trying to restrict certain dates in a cell using the following custom Data validation formula

if(H2=12/10/2013,12/25/2013,False)

But unable to achieve the desired result. i am sure there is a problem in formula. Can some one please correct the formula.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
What exactly is the formula meant to mean? If H2 should only be one of those two dates, use:
=OR(H2=date(2013,12,10),H2=date(2013,12,25))
If H2 should be between the two dates, use:
=AND(H2>=date(2013,12,10),H2<=date(2013,12,25))
 
Upvote 0
Hi,

Try this instead:

=OR(H2=DATEVALUE("12/10/2013"),H2=DATEVALUE("25/12/2013"))

Regards
 
Upvote 0
what formula should i use for the following case

Actually H2 should not be equal to the following dates
12/10/2013
12/25/2013


Thank you
 
Upvote 0
=NOT(OR(H2=date(2013,12,10),H2=date(2013,12,25)))
 
Upvote 0
=NOT(OR(H2=date(2013,12,10),H2=date(2013,12,25)))

Thank you Rory.
The formula which you gave is working. But i have a big list of dates (holidays of 6 months) and the formula seems to be apt when, only few dates are to be restricted. So, is it possible to achieve desired result using vba ? If yes, can you please tell how the code should be ?
 
Upvote 0
If you have a list of dates, enter them in a range and then use:
=ISNA(MATCH(H2,your_date_cells,0))
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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