Closed Thread
Results 1 to 12 of 12

i need to pull information from two columns and end of up with a customer number, VBA?

  1. #1
    Registered User
    Join Date
    06-18-2013
    Location
    canada
    MS-Off Ver
    Excel 365 (Mac)
    Posts
    26

    i need to pull information from two columns and end of up with a customer number, VBA?

    i have to pull the first four characters from a cell (has to be characters; must exclude dashes and "&" symbols) and also must sequence the results at the end with a "-1" or "-2" .... and so on; depending on how many times the first 4 numbers have recurred in the previous above cells, must decide if its a -1 or a -2, or -3......


    ie ; A B C
    ref # CUSTOMER ID customer name

    33 BALL-1 Ball packaging europe
    33 BALL-1 Ball packaging canada

    IE#2

    A B C
    ref # CUSTOMER ID customer name

    1 BALL-1 Ball packaging europe
    234 BALL-2 Ball packaging canada

    NOTICE THAT EVEN IF THE FIRST 4 LETTERS IN COLUMN C ARE THE SAME IF THE NUMBERS IN COLUMN A DONT MATCH THEN COLUMB B NEEDS TO COUNT UP



    WHO CAN DO THIS I NEED TO ENTER 11,000 FILES BY HAND IF NO-ONE CAN HELP

    PLEASE PLEASE HELP!!

    I HAVE PICTURES IF YOU NEED THEM
    Attached Images Attached Images
    Last edited by nate02167; 06-19-2013 at 08:39 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Here is an interesting and difficult one for an expert!!

    Hi and welcome to the forum

    We would love to help you with your question, but 1st, in accordance with forum rules, please rename your thread to something more meaningful, that actually describes your problem.

    Because thread titles are used in searching the forum it is vital they be written to accurately describe your thread content or overall objective using ONLY search friendly key words. That is, your title used as search terms would return relevant results.

    Many members will look at a thread title, and if it is of interest to them, or it falls within their area of expertise, they might only open those threads.

    Look at it this way...if you typed that title into google, what would you expect to get back?
    To change a Title on your post, click EDIT on you're 1st post, then Go Advanced and change your title

    Also, Please do not upload a picture of your file...rather, upload a sample of your workbook, showing what data you are working with, a few samples of your expected outcome is (manually entered is ok) and how you arrived at that. (exclude sensitive info). Pictures are pretty much impossible to edit, and no-one wants to re-type your data for you
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Here is an interesting and difficult one for an expert!!

    I started but have run out of time. Hopefully one of the experts will come through and help you out.

    My inital gut (assuming goal is in fact <from screenshot> to analyze strings in D and render them as you have defined in C) says to load every company name into an array, build a collection of the unique 4-letter instances, and then test each array item as being equal. If yes, increase counter and append array item + "-" + counter value.

    This loads all data into an array and then creates the collection. Like I said, someone may or may not choose to take this direction. Good luck.

    Please Login or Register  to view this content.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Here is an interesting and difficult one for an expert!!

    May be this...

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Here is an interesting and difficult one for an expert!!

    Hi,

    there were times in this forum when Rule 7 was regarded by senior members:
    7. Don't ignore requests by Administrators, Moderators, or senior members of the forum. If you are unclear about their request or instructions, then send a private message to them asking for help. Do not post a reply in a thread where such a request (e.g., title change, code tags) is pending.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Here is an interesting and difficult one for an expert!!

    @ HaHoBe,

    Thanks for pointing it

    In fact I have not read FDibbins post I just seen his long reply and I thought he is requesting for File. I never give attention to long and lengthy passage messages even if the question is big passage I just simply close that thread.

    It is my mistake I should have paid attention to that thread

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Here is an interesting and difficult one for an expert!!

    AlvaroSiza & SS,

    Both of you being senior members, i am sorry but i have to give you the infraction as Holger pointed out.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Here is an interesting and difficult one for an expert!!

    No issues it's my mistake

    One request from my end, Whenever something goes against forum rules please add those text with some formatting like Bold/Underline/Different Font Color/In CAPS so that it capture other eyes easily.

    As far as I seen FDibbins writes lot of informative passages to OP's by describing what are all the methods are available to get the solution and how the data needs to be structured with lot of tips in his posts and by mistake I thought the post is something like that...

    Because I wont read all the texts since it take more time for me to read it so just requesting the formatting to the texts whenever something goes against forum rules which will help me to stay away from infractions
    Last edited by :) Sixthsense :); 06-19-2013 at 02:00 AM.

  9. #9
    Forum Contributor
    Join Date
    05-02-2013
    Location
    Indiana
    MS-Off Ver
    Excel 2016
    Posts
    190

    Re: Here is an interesting and difficult one for an expert!!

    I just had a few questions. You mentioned that you must exclude dashes and "&" symbols, but what about other symbols like a period. I have guessed at what the part numbers would look like on the following, would this be correct?


    ALLO-01 ALLOY INDUSTRIAL CONTRACTORS
    ALLO-02 A.L. LOYD INC.
    ALLO-03 A & L LOYD INDUSTRIES INC.

    If this is correct, then you have to exclude periods. Or what about spaces? I suppose there could also be numbers in the name:

    123C-01 123 CONTRACTORS LLC INC
    123C-02 123 COMPARTMENTS UNLIMITED INC.

    I would presume the possibilities for company names would include the following

    Letters: A - Z and a - z
    Numbers: 0 - 9
    Symbols: &, period, comma, space, dash

    Inorder to code this program we have to have all the details and possibilities. Please be very specific. The example you gave, looked like it was already in alphabetical order. Does the code need to alphabetize the list? Also, what about upper and lower case letters? If we have a company list like this:

    BECK-01 Beck HPC Inc.

    or

    Beck-01 Beck HPC Inc.

    Just from your example, it looks like you would like the customer ID to be capitalized, is that correct?

    This is just a list of a few questions that would make it more clear. Thanks!

  10. #10
    Registered User
    Join Date
    06-18-2013
    Location
    canada
    MS-Off Ver
    Excel 365 (Mac)
    Posts
    26

    Post Re: Here is an interesting and difficult one for an expert!!

    I tried you formula ( thank you by the way) and it came up with the following screenshot, im probably inputting something wrong

    please review my image

    thanks again

    i will post a picture bellow i guess because i dont know how to attach a pic to this msg

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: i need to pull information from two columns and end of up with a customer number, VBA?

    redsab...
    Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore requests by Administrators, Moderators and senior forum members regarding forum rules.

    If you are unclear about the request or instruction then send a private message to them asking for clarification. Do not post a reply in a thread where a moderator has requested an action that has not yet been complied with e.g Title change or Code tags...etc

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Here is an interesting and difficult one for an expert!!

    Nate you have been repeatedly asked to change you're thread title. I am now closing this thread - you can start another - with a more descriptive thread title!!

Closed 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