+ Reply to Thread
Results 1 to 4 of 4

Data Validation

  1. #1
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408

    Question Data Validation

    Hi,

    Okay, let me try to simplify my problem.

    Cell CN2 is formatted as d and contains the formula:
    =DATE(2006,7+1,0)

    Cell CP2 is also formatted as d and contains the formula:
    =IF(CN2=DATE(2006,7+1,0),"",DATE(2006,7+1,0))

    CK5 is the input cell and needs to be restricted to accept only the number in CN2 - if CP2 is blank, or a numbers greater than or equal to the number in CN2 and less than or equal to the number in CP2 - if CP2 is not blank.

    So I set the Validation citeria to Custom, and try to entered the following formula:

    =OR(AND(CK5>=DAY($CN$2),CK5<=DAY($CP$2)),AND(CK5=DAY($CN$2),$CP$2 =""))

    I get the message "The formula currently evaluates to an error. Do you which to continue?"

    When I choose "Yes," it does not accept 31 in cell CK5, (but when I delete the formula in cell CP2 - leaving the cell blank, it accepts 31 only)

    I know that the problem is being caused by the blank ("") in cell CP2 but I can't figure out how to fix it.

    Any help?

    Thanks,
    Gos-C
    Using Excel 2010 & Windows 10
    "It is better to be prepared for an opportunity and not have one than to have an opportunity and not be prepared."

  2. #2
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094
    Gos-C,

    In the Data validation option select Whole Number and between.

    In the Minimum enter =DAY(CN2)

    In the Maximum enter =IF(CP2<>"",DAY(CP2),DAY(CN2))

    This sets the minimum to whatever is in CN2 and the maximum to CN2 if CP2 is blank and CP2 if CP2 is not blank.

    HTH

    Steve

  3. #3
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408

    Thumbs up

    Yes! It worked. Thanks a million, Steve. Appreciate your help.

    Gos-C

  4. #4
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094
    Glad I could help and thanks for the feedback.

    Steve,

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1