+ Reply to Thread
Results 1 to 3 of 3

Macro to populate values based on column A

Hybrid View

  1. #1
    Registered User
    Join Date
    12-06-2016
    Location
    INDIA
    MS-Off Ver
    2016
    Posts
    12

    Macro to populate values based on column A

    Hi,

    I need a macro to populate values based in the column A, I have value in column A as below in column B the role should reflect


    Column A Column B
    Data1-Admin-2-1 Admin
    Data1-Clerk-2-2 Clerk
    Data1-Super-User-2-3 Super-User
    Data2-Admin-2-1 Admin
    Data2-Clerk-2-2 Clerk
    Data2-Super-User-2-3 Super-User

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: Macro to populate values based on column A

    This is a very simple task and can be accomplished very quickly by someone familiar with Excel in general, let alone VBA. If you'd like to learn some VBA so that you can do things like this without having to ask someone else I suggest you begin with this thread:

    http://www.excelforum.com/showthread.php?t=823709

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: Macro to populate values based on column A

    In addition to BellyGas suggestion, here is a formula that will derive your expected results.

    v A B C
    1 Original Data Output Formula in column B
    2 Data1-Admin-2-1 Admin =MID(A2,FIND("-",A2)+1,FIND(CHAR(1),SUBSTITUTE(A2,"-",CHAR(1),2))-FIND("-",A2)-1)
    3 Data1-Clerk-2-2 Clerk =MID(A3,FIND("-",A3)+1,FIND(CHAR(1),SUBSTITUTE(A3,"-",CHAR(1),2))-FIND("-",A3)-1)
    4 Data1-Super-User-2-3 Super =MID(A4,FIND("-",A4)+1,FIND(CHAR(1),SUBSTITUTE(A4,"-",CHAR(1),2))-FIND("-",A4)-1)
    5 Data2-Admin-2-1 Admin =MID(A5,FIND("-",A5)+1,FIND(CHAR(1),SUBSTITUTE(A5,"-",CHAR(1),2))-FIND("-",A5)-1)
    6 Data2-Clerk-2-2 Clerk =MID(A6,FIND("-",A6)+1,FIND(CHAR(1),SUBSTITUTE(A6,"-",CHAR(1),2))-FIND("-",A6)-1)
    7 Data2-Super-User-2-3 Super =MID(A7,FIND("-",A7)+1,FIND(CHAR(1),SUBSTITUTE(A7,"-",CHAR(1),2))-FIND("-",A7)-1)

    Because you are using a Hyphen in your position name, you will not always get the correct answer. Suggest you amend your original data to avoid the hyphen in the middle of the job name.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. Macro that compares Values in a Column to Based on Values in Different Column
    By rjw524 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-28-2016, 01:26 PM
  2. Finding a macro that will populate a table from another table based on a columns values
    By Daril_Ghiroza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2015, 02:26 PM
  3. [SOLVED] Macro to Populate cells in a column based on criteria
    By Blokeman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2015, 07:59 PM
  4. Macro - how to auto populate the data, based on the previous cell values
    By Avinash Kumar in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-21-2012, 02:03 PM
  5. Replies: 3
    Last Post: 02-28-2012, 11:54 AM
  6. Macro to auto populate the destination cell based on the values of the previous cell
    By Avinash Kumar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-05-2009, 02:06 AM
  7. Macro - auto populate the values based on previous cell values
    By Avinash Kumar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2009, 02:02 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