+ Reply to Thread
Results 1 to 10 of 10

Checking Character Length in a specific row and column

  1. #1
    Registered User
    Join Date
    02-22-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    25

    Checking Character Length in a specific row and column

    Hi, I'm still a noob when it comes to excel programming and I'd like to ask if there is any way where I can automatically choose to check the character length of a specific row?

    I have an excel sheet with 20 columns ranging from column A-T. each column has a specific character restriction such as A can only have 3 characters, B can have 4 etc. until T. These columns are considered as Headers that needs to be checked if the number of characters they have are correct.

    However, I have a lot of Headers in that Worksheet that needs to be checked and the number of rows where each header may start is not predefined. Meaning, a header may begin at row4,row9,row11,row20 etc.

    I know I need to make a loop, but the problem is, I don't know how to increment my column from Column A to column B etc so that I can check each cell's character length. I need to increment my Column 20times and then check the character length, afterwards I need to go to the next row until I encounter another header and then check the columns again.

    Can someone please tell me how I can increment the column and go to the next row? I'd really appreciate any help. :D
    Last edited by crisshinn; 03-05-2011 at 01:17 AM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Checking Character Length in a specific row and column

    Hello crisshinn,

    I have provided an example that may or may not fit your situation.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    02-22-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Checking Character Length in a specific row and column

    Thank you Leith I think this will work, although I think? (correct me If I misunderstood) that this code assumes that you know the exact row where the headers are located, which are the rows 4,9,11,20.

    In my case, the rows where headers are located can be in any row number. I'm sorry i forgot to mention that each header starts with the "PLC" string. So I think this makes it my counter to determine where my next header is located, although how do I get to the next row and check?

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Checking Character Length in a specific row and column

    Hello crisshinn,

    Do you have an example workbook you can post? It will be easier to answer your question when I see the layout.

  5. #5
    Registered User
    Join Date
    02-22-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Checking Character Length in a specific row and column

    sure I made a simple sample layout....uhm but how do I upload the file? xD

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Checking Character Length in a specific row and column

    To attach a file to your post, you need to be using the main 'New Post' or 'New Thread' page and not 'Quick Reply'.
    To use the main 'New Post' page, click the 'Post Reply' button in the relevant thread.

    On this page, below the message box, you will find a button labelled 'Manage Attachments'.
    Clicking this button will open a new window for uploading attachments.

    You can upload an attachment either from your computer or from another URL by using the appropriate box on this page.
    Alternatively you can click the Attachment Icon to open this page.

    To upload a file from your computer, click the 'Browse' button and locate the file.

    To upload a file from another URL, enter the full URL for the file in the second box on this page.
    Once you have completed one of the boxes, click 'Upload'.

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.

  7. #7
    Registered User
    Join Date
    02-22-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Checking Character Length in a specific row and column

    Ah thank you :D Here is a sample file of what it's supposed to look. The details in that worksheet are the sample headers that needs to be check. In the whole program, we're supposed to be able to upload a file from a worksheet, check the character length and then save it in a new file. But my part is in the checking the character length.

    Since files will be uploaded, you can just imagine that the places where the headers can be located can be randomly found in any row so thats why I need to check the first cell of every row if it contains a counter such as the PLC, BFT, CBT etc.

    thank you much for the help ;D
    Attached Files Attached Files

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Checking Character Length in a specific row and column

    Hello crisshinn,

    Thanks for posting the workbook. I am still not sure I follow you on this, so I have a few questions.

    Do all 20 cells in the row have to match specific lengths before that row is recognized as a header?

    What are the lengths for each of 20 columns?

  9. #9
    Registered User
    Join Date
    02-22-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Checking Character Length in a specific row and column

    You noticed the PLC, BFT, KBT and CFT right? they are the headers. So i was thinking of having an If statement at the very beginning to determine if a row is a header. It's considered a header if it contains anyone of those 3character code I mentioned. Now as for the columns,

    These are the character length per column.
    A =3, B=4,C=35, D=6, E=3, F=5, G=35, H=10, I=10,J=35, K=35, L=33, M=3, N=70, O=35, P=10, Q=35, R=35, S=10, T=40

  10. #10
    Registered User
    Join Date
    02-22-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Checking Character Length in a specific row and column

    just an additional
    Attached Files Attached Files
    Last edited by crisshinn; 04-27-2011 at 08:04 PM.

+ 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