+ Reply to Thread
Results 1 to 14 of 14

check duplicate and length of number in specific column

  1. #1
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    check duplicate and length of number in specific column

    good afternoon all
    can someone advice me how can add to my code
    HTML Code: 
    that not allow to save data if there is some any duplication in data in column E in Sheet10 or value in length less or more than 10 digit
    and highlight this value that allow to edit it then can save file again

  2. #2
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: check duplicate and length of number in specific column

    You forgot to place the sample file. So just a guess

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: check duplicate and length of number in specific column

    I post sample file with three button
    one for check duplication (its work)
    second for check length (not work well )
    third that want to mix between two code that prevent save before make correction for duplication and length
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: check duplicate and length of number in specific column

    Doesn't it just work? Small adjustment

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: check duplicate and length of number in specific column

    It does not work
    please kindly find file with correct length (10 number) and no duplication

    also code in secod buuton doesnot work , can check please for me what is wrong in this code , it used for length check and highlight incorrect data with yellow and give how many cell incorrect
    HTML Code: 

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: check duplicate and length of number in specific column

    just in case you also want a formula solution:

    G2 =IF(LEN(E2)=10=TRUE,"correct","")

    H2 =IF(COUNTIF($E2:$E$50,$E2)>1,"duplicated","no dup.")

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  7. #7
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: check duplicate and length of number in specific column

    Thank you so much dear oeldere for your idea
    but what about vba code
    even correct code in my post number 5 for my case to detect incorrect length

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: check duplicate and length of number in specific column

    I have not enough noledge of VBA to help you with your problem.

  9. #9
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: check duplicate and length of number in specific column

    thank you so much , hope someone expert VBA can solve this for me

  10. #10
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,996

    Re: check duplicate and length of number in specific column

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Ben Van Johnson

  11. #11
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: check duplicate and length of number in specific column

    @ protonLeah

    Great work , thank you so much its work very well

  12. #12
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: check duplicate and length of number in specific column

    @protonLeah
    Dear protonLeah
    first , I apologize for this
    can check attached file , because after add code to original data file , not work well like in attached file
    I try to see what is wrong , but can't
    Attached Files Attached Files

  13. #13
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,996

    Re: check duplicate and length of number in specific column

    I don't know what "...doesn't work well..." means

    Put the global variables:
    Option Explicit
    Public DupCount As Long
    Public BadLen As Long
    Public DupCheck As Boolean
    Public LenCheck As Boolean
    in a standard module (Module1)

    Modified duplicate check for case of no duplicates found:
    Please Login or Register  to view this content.
    modified length check for case of empty cells
    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: check duplicate and length of number in specific column

    @protonleah
    Dear Protonleah
    thank you so much for you improve the code to check how many cells is empty also, its so great

    as in my attached, I only need check column E, Not F and G
    Attached Images Attached Images

+ 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. [SOLVED] Unlocking numerous check boxes in a single column, variable column length
    By PeteSpec in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-12-2019, 03:54 PM
  2. Replies: 2
    Last Post: 03-21-2019, 12:21 PM
  3. Check for Number in one column - then count specific numbers in a range.
    By CarlosM1 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-29-2014, 05:10 AM
  4. Check for duplicate, then if found check for any changes in a different column?
    By brenweb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-02-2012, 07:39 AM
  5. Check the length and value of specific columns and comparion check between two sheets
    By sravanthi.boggaram in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-06-2011, 06:51 AM
  6. Checking Character Length in a specific row and column
    By crisshinn in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-27-2011, 07:02 AM
  7. [SOLVED] How to check a column so that no duplicate number?
    By Rocky in forum Excel General
    Replies: 6
    Last Post: 01-10-2005, 03:51 AM

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