+ Reply to Thread
Results 1 to 8 of 8

Check text in cells and delete/add column accordingly

  1. #1
    Registered User
    Join Date
    11-01-2009
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Check text in cells and delete/add column accordingly

    Hi,

    Would appreciate any help :D

    I receive thousands of raw data every week as shown in the excel sheet {raw data}

    I would like to use a macro that could automatically sort the raw data like the format in the excel sheet {template}

    For example:

    Looking at the raw data and compare with the template, i would have to delete the whole columns that have (BU_CODE , EAN_CODE, SUPPLIER_CODE, SUPPLIER_NAME , BRAND_NAME, and SUB_CATEGORY_CODE) and add in columns and name it as Principal, Cateogry , Brand and range).

    The sequence has to similar to the excel sheet {template}

    Thanks in advanced!
    Attached Files Attached Files
    Last edited by help pls; 11-07-2009 at 10:10 PM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Check text in cells and delete/add column accordingly

    Welcome to the Board.

    Perhaps something along the lines of:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-01-2009
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Check text in cells and delete/add column accordingly

    Hi,

    Thanks for replying!

    I tried something along that line too but i faced one problem. If i run the macro twice, it will delete those columns that i need too. Is there another way that it will not delete those columns i need even if i accidentally click twice?

    I 'm thinking along the line of : if cell = BU CODE, delete the column, (if not) do nothing or a loop function?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Check text in cells and delete/add column accordingly

    Is there another way that it will not delete those columns i need even if i accidentally click twice?
    Well yes, given you know what the values of the new columns are and where they will be located if they exist...

    Please Login or Register  to view this content.
    On an aside this thread is being moved to the Programming Forum (from Worksheet Functions)

  5. #5
    Registered User
    Join Date
    11-01-2009
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Check text in cells and delete/add column accordingly

    yeah! it works!

    thanks Donkeyote!

    by the way i have one last question:

    After deleting and adding the columns, i would need to fill in the columns for the empty cells.

    This is an example: if the product description in column H = hand wash, i would need the corresponding cells to fill in an A under the principle, category =12 etc..

    Can i have a new sheet that has this following table and use the macros to link from the sheet and run a lookup function?

    Principle Category Brand Sub Cat Range
    HAND WASH A 12 yes lotion males
    FACIAL WASH B 11 No lotion females

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Check text in cells and delete/add column accordingly

    Can i have a new sheet that has this following table and use the macros to link from the sheet and run a lookup function?
    Yes. If you want dummy code post a sample which illustrates the approach you wish to adopt.

  7. #7
    Registered User
    Join Date
    11-01-2009
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Check text in cells and delete/add column accordingly

    Hi

    Attached the "Table" in excel sheet {fill}

    thanks!
    Attached Files Attached Files

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Check text in cells and delete/add column accordingly

    Based purely on your sample file

    Please Login or Register  to view this content.

+ 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