+ Reply to Thread
Results 1 to 8 of 8

Using data validation to set naming conventions

  1. #1
    Registered User
    Join Date
    11-20-2007
    Posts
    33

    Using data validation to set naming conventions

    I'm trying to use the data validation to make sure people use the same format when entering product codes into a s/sheet.

    The product codes are 5 numeric digits teh letter 'v' then one or more numeric digits again.
    eg
    12345v1
    12345v12
    16549v3

    Is there a way to use custom validation to make sure that the text entered follows this convention?

    Thanks for any help you can offer.

    DrEvilAces

    If life is like a box of chocolates, then my boss is the coffee flavoured one!!

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Using data validation to set naming conventions

    Hi,

    Try: =AND(LEN(A1)=7,ISNUMBER(LEFT(A1,5)*1),MID(A1,6,1)="v",ISNUMBER(RIGHT(A1,1)*1))

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  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: Using data validation to set naming conventions

    Hi,

    I think this gives you what you want

    =AND(ISNUMBER(VALUE(LEFT(A1,5))),MID(A1,6,1)="v",ISNUMBER(VALUE(RIGHT(A1,LEN(A1)-FIND("v",A1)))))
    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
    Registered User
    Join Date
    11-20-2007
    Posts
    33

    Re: Using data validation to set naming conventions

    Thanks a lot for your help guys.
    Sweep yours works perfectly, Domski thanks for your help but yours does'nt allow codes with 2 digits after the v only one it seems.

    Sweep yours works a treat thanks for such a quick response from you both
    :D

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

    Re: Using data validation to set naming conventions

    Another variant

    Please Login or Register  to view this content.
    I was trying to come up with a way of avoiding the search altogether - ie just LOOKUP - but couldn't (roundings etc) - any bright ideas ?

  6. #6
    Registered User
    Join Date
    11-20-2007
    Posts
    33

    Re: Using data validation to set naming conventions

    Thanks for trying but according to excel:
    You may not use unions, intersections, or array constants for Data Validation criteria.
    Nevermind, I'm happy with Sweeps version, but thanks for having a go

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

    Re: Using data validation to set naming conventions

    Sorry - yes - quite right - there's no blush icon here unfortunately... helps to have the brain turned on (and test) I guess.

  8. #8
    Registered User
    Join Date
    11-20-2007
    Posts
    33

    Re: Using data validation to set naming conventions

    One last quick question!

    I've set Input Messages on the column headers to explain what needs entering where, but when you select the cell, the messages all appear in the sam place, and not next to the selected cell, if I move it, then all the messages open in that place, not just the one I moved.

    Can this be changed or is it something I just need to live with?
    (If I cant change it, I'll go back to using comments!)

    Thanks

    :D

+ 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