+ Reply to Thread
Results 1 to 13 of 13

Data Validation to Ensure Like Numbers in Cell A has Same Date in Cell B

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

    Data Validation to Ensure Like Numbers in Cell A has Same Date in Cell B

    Hi all,

    I am trying to set up a data validation to ensure that when a user enters a number in column A that matches a previously entered number in column A, the user is only allowed to enter the same date for the number it matches in column B.

    For example, if:

    Row 3 column A = 1320

    and

    Row 3 column B = 16-Dec-07

    and

    Row 15 column A = 1320

    then:

    Row 15 column B must be 16-Dec-07

    Any help?

    Thank you,
    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
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    If you want to get a workable answer you need to add more info as I assume you have more than one number and one date.

    Also how do we know what the link is between your number and the date ??

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408
    Hi VBA Noob,

    Column A contains job numbers and column B contains the dates when the jobs in column A were created. The job numbers are entered several times and, in order to have the correct result from formulas, the like job numbers must have the same dates.

    HTH

    Thanks,
    Gos-C

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Select your range starting at cell B2 and in the Data Validation window, select Custom from the Allow section and enter formula: =B2=LOOKUP(2,1/($A$1:A1=A2),$B$1:B1)

    click Ok.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  5. #5
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408
    Hi NBVC,

    It works only when all the numbers are the same.

    Gos-C

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Not sure what you mean. Please elaborate.

  7. #7
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408
    Hi NBVC,

    Take a look at the attached file, and re-enter the dates shown so that you could see where the data validation is not working.

    Thanks,
    Gos-C
    Attached Files Attached Files
    Last edited by Gos-C; 01-11-2008 at 01:47 PM.

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    This seems to work:

    Select your range starting at cell B2 and in the Data Validation window, select Custom from the Allow section and enter formula:

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408
    Hi NBVC,

    It didn't work. I was able to enter any date for all the numbers.

    Gos-C

  10. #10
    Registered User
    Join Date
    01-25-2007
    Posts
    21

    Data validation tips!

    Hello Gos-C!

    It seems any how you're going to manually enter very first value and then only you wanted to match the same value if the data you're entering also same. As data validation feature only validate pre-set values, I've some tricky vlookup function which will pull the date if any you've already entered in Column "B" upto previous row, then produce a match!

    The code:

    =IF(ISNA(VLOOKUP(a2,$a$1:b2,2,0)),"Enter your date",TEXT(VLOOKUP(a2,$a$1:b2,2,0),"dd/mm/yy"))

    Give a try!

    DOES

  11. #11
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408
    Hi DOES,

    Thanks for your reply. I can't get it to work. Did it work for you? Where am I putting the code (in the Data Validation window)? I am getting an error for any date I enter in any cell from B2 down.

    Gos-C

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by Gos-C
    Hi NBVC,

    It didn't work. I was able to enter any date for all the numbers.

    Gos-C
    It's working fine for me....see attached.

    Enter dates in cells B2 down....

    When you come to B4, if the date doesn;t match what's in B2, you get an error, but if it matches, it is accepted.

    Does it not work for you?
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    09-19-2004
    Location
    Canada
    Posts
    408
    Hi NBVC,

    Yes, it works - great! I must had done something wrong.

    Thanks a million.

    Gos-C

+ 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