+ Reply to Thread
Results 1 to 7 of 7

Macro to Split and Remove based on cell value

  1. #1
    Registered User
    Join Date
    11-14-2012
    Location
    Chennai,India
    MS-Off Ver
    Excel 2010
    Posts
    32

    Macro to Split and Remove based on cell value

    Hi,
    This is my input:

    Col A
    asde,dsfts-qwsa/001,asdasd-qwsa,asdas
    etert,ttyutt-tww/013,dgdd-tww,dsfsaa
    .
    .
    .
    .
    .

    Col B
    qwsa
    tww

    In Col C.. I want the output to be as

    asde,asdas
    etert,dsfsaa

    Requirement as a text:
    I need a macro that removes the value in column A based on the value in Col B.
    The data that the macro removes is always between the "," (comma).

    Please Help.
    Karthik

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

    Re: Macro to Split and Remove based on cell value

    This can be easily done with the help of a formula,

    Assuming that you have text in A2, then

    in B2

    Please Login or Register  to view this content.
    In C2

    Please Login or Register  to view this content.
    Does it help?
    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
    Registered User
    Join Date
    11-14-2012
    Location
    Chennai,India
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Macro to Split and Remove based on cell value

    Thanks for the quick response.
    No.
    Data in Col B is already present.
    The macro/formula should look for the string that is present in Col B in Col A and remove the data within the "," (comma).

    Did u get me?

    Quote Originally Posted by sktneer View Post
    This can be easily done with the help of a formula,

    Assuming that you have text in A2, then

    in B2

    Please Login or Register  to view this content.
    In C2

    Please Login or Register  to view this content.
    Does it help?

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

    Re: Macro to Split and Remove based on cell value

    No, I didn't get it.
    Better you upload a sample workbook along with the expected output. Do you want to update data within the column A based on column B?
    You need to clarify it.

  5. #5
    Registered User
    Join Date
    11-14-2012
    Location
    Chennai,India
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Macro to Split and Remove based on cell value

    Please find the attached excel.
    Quote Originally Posted by sktneer View Post
    No, I didn't get it.
    Better you upload a sample workbook along with the expected output. Do you want to update data within the column A based on column B?
    You need to clarify it.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to Split and Remove based on cell value

    Try the attached.
    Attached Files Attached Files

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

    Re: Macro to Split and Remove based on cell value

    @AB33

    Nice code indeed.

    With my limited knowledge, I have written this code and it does what it is supposed to do as per the OP's requirement.
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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 to split based on condition
    By somusas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-19-2013, 07:42 AM
  2. [SOLVED] Macro to split cell data across multiple cells based on format-
    By Biased Historian in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-30-2013, 12:57 PM
  3. VB Macro to split cell based on " , "
    By pateltech in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-21-2012, 04:50 AM
  4. Need to split cell data and remove characters
    By jdough247 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-10-2011, 12:47 PM
  5. [SOLVED] Macro to split workbook into several based on cell contents
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-23-2006, 06:20 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