+ Reply to Thread
Results 1 to 8 of 8

formula for specified data validation required

  1. #1
    Registered User
    Join Date
    04-01-2010
    Location
    Worcester, UK
    MS-Off Ver
    Microsoft 365 (subscription)
    Posts
    50

    formula for specified data validation required

    Hi all excel experts!
    I am trying to apply data validation for cells E7:E1006.
    I would like to have a rule that only following format will be possible to input in those cells:
    4-digit number and a small letter (i.e. 1234a, 2345b, 6666d).
    Unfortunately I have no idea what formula I should use in data validation.
    Any help much appreciated.
    Thanks in advance!

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: formula for specified data validation required

    With E7:E1006 active - having selected E7 first - you could try a Custom DV Formula of:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: formula for specified data validation required

    Hi,

    Does this work for you?

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: formula for specified data validation required

    I should add that my suggestion is flawed should 0000 be valid
    To account for that you would need to use an ISNUMBER test rather than rely on coercion (coercion of 0000 would lead ultimately to a FALSE result)

  5. #5
    Registered User
    Join Date
    04-01-2010
    Location
    Worcester, UK
    MS-Off Ver
    Microsoft 365 (subscription)
    Posts
    50

    Re: formula for specified data validation required

    Works as it should, thank you very much!!!
    Just to get some knowledge how it works so next time maybe I will be able to adapt this into my needs:
    which part determines what?
    I suppose =(LEN($E7)=5) tells that format of input will have 5 characters, but I have no idea about the rest... what number 97 and 122 are there for?
    Thanks for patience, code works perfectly I am just person which does not like to get something done by somebody else and use it if I do not understand how it works...

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: formula for specified data validation required

    "a" is Char 97
    "z" is Char 122
    CODE function is used to determine the CHAR # of a given character

    If the returned value sits outside of the 97-122 boundaries you know it's not lower case a-z

  7. #7
    Registered User
    Join Date
    04-01-2010
    Location
    Worcester, UK
    MS-Off Ver
    Microsoft 365 (subscription)
    Posts
    50

    Re: formula for specified data validation required

    Thanks for explanation. Just wondering about something else. Is there possibility to modify it so it is still requiring following code format (i.e. 1234a - 4-digit and small letter) but this code can be used only if is on the list which is located in range A3:A in tab called 'LOOKUP' (I can't give end of the codes range as it will grow as new codes are added).
    Hope I was clear enough in explaining this...

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: formula for specified data validation required

    If it transpires that LOOKUP!A3:An includes only valid entries then just apply a MATCH test regards the DV:

    Please Login or Register  to view this content.
    where _DVList is a Dynamic Named Range defined as:

    Please Login or Register  to view this content.
    which will resize as records are added/removed from the listing

    Note: LOOKUP is a function - it's best to avoid naming sheets the same as functions etc for sake of clarity - would suggest renaming to LOOKUPS or some such.

+ 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