+ Reply to Thread
Results 1 to 6 of 6

HELP : formula or macro to set a particular code different number of customers

  1. #1
    Registered User
    Join Date
    04-14-2014
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    11

    Exclamation HELP : formula or macro to set a particular code different number of customers

    Hi,

    Actually I have a large amount of data having many customers. Some customers having a different code but they are related with one code.

    So, I want to give them a new code on the basis of previous code and their name.

    I am comparing their previous code first, then their first two names for giving them new code.

    Would be grateful if anyone could provide the formula or macro code as per the data in the attached excel sheet.
    Attached Files Attached Files

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: HELP : formula or macro to set a particular code different number of customers

    Would you explain that what logic is behind the new codes shown in Col. G? Because G4:G15 seems to have same logic but G16:G19 seems to have different one.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    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,929

    Re: HELP : formula or macro to set a particular code different number of customers

    Agree with sktneer that the logic for the last few seems different?

    On the assumption that you made a mistake with the last few, try this, copied down...
    =MID(D4,FIND("-",D4,1)+1,FIND(" ",D4,1)-1-FIND("-",D4,1))
    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

  4. #4
    Registered User
    Join Date
    04-14-2014
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: HELP : formula or macro to set a particular code different number of customers

    Hi,


    Thanks for reply.

    Logic is same for all three cases.

    In first case(D4:D9) code is different like DAB126, DHR 134 for same customer 'AB Mart' so I have selected AB as new code same as in second case. But in third case system generated customer code is common so I have selected ADB129 as new code.

    My first preference is system generated code if it matches then code is selected as new code if not then I have to compare first two words of customer name and then first word of customer name is selected as new code.

    On the basis of new code I have to arrange them as one customer instead of many. Like in first case (D4:D9) new code is AB for the whole group.
    Last edited by mchawla; 04-17-2014 at 02:16 PM.

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: HELP : formula or macro to set a particular code different number of customers

    Why not be consistent and use the first two letters after the "-" as the basis for the code.

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


    The result would be:
    AB
    AB
    AB
    AB
    AB
    AB
    AR
    AR
    AR
    AR
    AR
    AR
    RA
    RA
    RA
    RA
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  6. #6
    Registered User
    Join Date
    04-14-2014
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: HELP : formula or macro to set a particular code different number of customers

    thanks for reply

    But I have to use already generated codes first if possible.

    After then I can go for first word of name for new code.

+ 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. Determine repeat customers vs. new customers based on purchase date
    By mktgdude in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-02-2013, 04:10 AM
  2. Create new sheet from list of customers code
    By pauldaddyadams in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-13-2011, 09:29 AM
  3. Replies: 1
    Last Post: 09-01-2010, 07:11 PM
  4. Finding unique number of customers
    By fibaroobi in forum Excel General
    Replies: 0
    Last Post: 08-25-2010, 11:39 PM
  5. Replies: 5
    Last Post: 01-16-2010, 01:17 AM

Tags for this Thread

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