+ Reply to Thread
Results 1 to 20 of 20

Alphanumeric Characters only - data validation

  1. #1
    Registered User
    Join Date
    05-19-2017
    Location
    Den Haag
    MS-Off Ver
    2010
    Posts
    4

    Alphanumeric Characters only - data validation

    Hi,

    I want to do data verification. Only Alphanumeric characters are allowed with the following form:

    1) Total length = 12
    2) First 8 characters = Alphanumeric
    3) Last 4 characters = Numbers

    Example: srdzzapp0309
    srpzzapp0310
    c1dafora0001
    c2dafora0001

    Can you please help

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,632

    Re: Alphanumeric Characters only - data validation

    Hi,
    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Best Regards,

    Kaper

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Alphanumeric Characters only - data validation

    Hi. Assuming data start in A1, you can use this formula:

    IF(AND(LEN(A1)=12,AND(CODE(UPPER(MID(A1,{"1","2","3","4","5","6","7","8"},1)))>=65,CODE(UPPER(MID(A1,{"1","2","3","4","5","6","7","8"},1)))<=90)=TRUE,SUM(IF(ISNUMBER(--MID(A1,{"9","10","11","12"},1)),1,0))=4),TRUE,FALSE)
    Attached Files Attached Files
    Last edited by Glenn Kennedy; 05-19-2017 at 06:43 AM.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Registered User
    Join Date
    05-19-2017
    Location
    Den Haag
    MS-Off Ver
    2010
    Posts
    4

    Re: Alphanumeric Characters only - data validation

    Thanks. This Works.

    Can the data validation be done on existing values given in the excel. Something like the cell background will become red if it doesn't match the data validation criterion.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Alphanumeric Characters only - data validation

    Excel doesn't like arrays - the bits inside the {} - in CF. So this is the nearest I can reasonably get... Apply the formatting to whatever range you need. Currently applied from A1 to B20
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Alphanumeric Characters only - data validation

    Good point about the arrays. FYI, your first formula could be simplified significantly. No need for the quotes around the 1,2,3... and some of the extra AND's and the last 4 digits can be tested as 1.

    =AND(LEN(A1)=12,CODE(UPPER(MID(A1,{1,2,3,4,5,6,7,8},1)))>=65,CODE(UPPER(MID(A1,{"1","2","3","4","5","6","7","8"},1)))<=90,ISNUMBER(--RIGHT(A1,4)))
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Alphanumeric Characters only - data validation

    Good point about the end number...

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Alphanumeric Characters only - data validation

    I think this could work too
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B
    1 srdzzapp0309 TRUE
    2 srpzzapp0310 TRUE
    3 c1dafora0001 FALSE
    4 c2dafora0001 FALSE
    5 1234asdfghjk FALSE
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Alphanumeric Characters only - data validation

    Alkey... I have no idea how that comes up with an answer... But

    A*CDEFGH1234

    doesn't work

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Alphanumeric Characters only - data validation

    Alkey... I have no idea how that comes up with an answer... But

    A*CDEFGH1234

    doesn't work

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Alphanumeric Characters only - data validation

    So, pradipto. after some discussions, this is probably the best to date...
    Attached Files Attached Files

  12. #12
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Alphanumeric Characters only - data validation

    Glenn,
    The OP's requirement is dealing with numerical/alphanumerical values. Asterisk is neither of them. It is an operator. I don't see the point of introduction of a foreign object that clearly doesn't belong there.

  13. #13
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Alphanumeric Characters only - data validation

    The OP's requirement is to ALLOW only alphanumerical values.

    So shouldn't c1dafora0001 and C2dafora0001 be true also? Glenn's array (and my simplification) only looks at the first value in the 1,2,3,4,5,6,7,8 sequence.
    Last edited by ChemistB; 05-19-2017 at 12:02 PM.

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Alphanumeric Characters only - data validation

    Incidentally... chaps. Have we ALL misread this?? The OPs reply at Post 4, to my first shot, suggests otherwise... but look at the EXACT wording of Post 1....

  15. #15
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Alphanumeric Characters only - data validation

    Pradipto, is 123456781234 a valid entry?

  16. #16
    Registered User
    Join Date
    05-19-2017
    Location
    Den Haag
    MS-Off Ver
    2010
    Posts
    4

    Re: Alphanumeric Characters only - data validation

    No 123456781234 is not a valid entry.

    1) Total length = 12
    2) First 8 characters = Alphanumeric
    3) Last 4 characters = Numbers

    Example: srdzzapp0309
    srpzzapp0310
    c1dafora0001
    c2dafora0001
    C3dafora8765

  17. #17
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Alphanumeric Characters only - data validation

    You have just repeated yourself, not provided any clarification.

    Of the 5 exampes you posted:
    srdzzapp0309
    srpzzapp0310
    c1dafora0001
    c2dafora0001
    C3dafora8765

    Which ones are OK. If ALL are OK, why is 123456781234 NOT acceptable?
    If only the first 2 are OK, then look back at post 11. Does this do/not do what you want. If it DOES NOT do what you want, please explain why.

    MORE EXPLANATION please.....

  18. #18
    Registered User
    Join Date
    05-19-2017
    Location
    Den Haag
    MS-Off Ver
    2010
    Posts
    4

    Re: Alphanumeric Characters only - data validation

    Hi,

    May be my explanation was not adequately clear:

    1) Total length = 12
    2) First 8 characters = Alphanumeric(Atleast one character must be present)
    3) Last 4 characters = Only Numbers

    123456781234 is not ok..because of condition 2)

  19. #19
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Alphanumeric Characters only - data validation

    =AND(LEN(A1)=12,COUNT(RIGHT(A1,4)+0),ISERROR(LEFT(A1,8)+0),LOOKUP(2,1/(MID(A1,ROW(INDIRECT("1:8")),1)+1),MID(A1,ROW(INDIRECT("1:8")),1)+1))
    Try above formula in Data Validation
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  20. #20
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Alphanumeric Characters only - data validation

    @pradipto
    What makes your explanation confusing is use of word "Alphanumeric".The term Alphanumeric in regard to examples provided, mean that all strings contain numbers and letters are Alphanumeric.

    https://en.wikipedia.org/wiki/Alphanumeric

    Now, which of these suggested strings you consider "valid"?
    srdzzapp0309
    srpzzapp0310
    c1dafora0001
    c2dafora0001
    C3dafora8765
    Last edited by AlKey; 06-05-2017 at 07:05 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. identifying specific data from a string of alphanumeric characters
    By koochandkai in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-07-2016, 09:31 PM
  2. [SOLVED] Data validation for alphanumeric entry of 1-5 numbers and 1 alpha
    By thecdnmole in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-04-2015, 01:17 PM
  3. Replies: 1
    Last Post: 11-13-2014, 06:50 PM
  4. Alphanumeric Data Validation, Input Mask?
    By bondingfortoday in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-20-2014, 10:34 PM
  5. alphanumeric data validation
    By pankajy18 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-02-2013, 01:07 PM
  6. alphanumeric Data Validation across tabs in a workbook
    By CharterJP in forum Excel General
    Replies: 17
    Last Post: 11-19-2010, 03:19 PM
  7. custom data validation for alphanumeric entry
    By wotadude in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-19-2009, 04:23 PM

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