Announcement

Collapse
No announcement yet.

Unconfigured Ad Widget

Collapse

Remove Text With Brackets & The Parenthesis

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Remove Text With Brackets & The Parenthesis

    I have a spreadsheet with 900 rows. All of the rows hold different information. The first column has contents such as this:

    This is the text (please remove me)
    This is some more text (I need to be removed too)

    I want to remove from every cell, everything in the brackets - so everything from the first open brackets to the end of the cell contents). Every cell is a different length and the information within the brackets is different.

    Please could someone help me?

    thanks

  • #2
    Re: Remove End Of Cell Contents

    Try
    Sub EliminateEndings()
    Dim i As Long, j As Long, n As Long
    Application.ScreenUpdating = False
    n = Cells(Rows.Count, 1).End(xlUp).Row
    For i = 2 To n 'assumes header
    j = InStr(Cells(i, 1), "(")
    If j > 0 Then Cells(i, 1) = Trim(Left(Cells(i, 1), j - 1))
    Next i
    Application.ScreenUpdating = True
    End Sub
    Please do not U2U (private message) me directly for questions that should be posted to the forum; any such U2Us will be ignored.

    Comment


    • #3
      Re: Remove End Of Cell Contents

      Thank you for the reply. Unfortunately I don't have knowledge of VB so please could you let me know what i should do with the code? I'm sure its very obvious but not to me! :-) Thanks

      Comment


      • #4
        Re: Remove End Of Cell Contents

        If you are just trying to remove everything inside of the parentheses, you don't need VBA. Just goto Edit, Replace. In the Find What: box, type (*)
        Leave the Replace With: box blank.

        Comment


        • #5
          Re: Remove End Of Cell Contents

          Another option would be to select the column and go Data>TextToColumns, select Delimited>Check the Other box and use an opening parenthesis "(" as the delimiter>on the next screen choose not to import the second column (ie everything after the first parenthesis>Finish.

          Richard

          Comment


          • #6
            Re: Remove End Of Cell Contents

            Thanks to all for your replies. NOt sure what i did wrong on your reply turtle, but it didn't work for me. Parsnip - worked exactly how i needed it. Thanks for all the help.

            Comment


            • #7
              Re: Remove End Of Cell Contents

              Originally posted by RichardSchollar View Post
              Another option would be to select the column and go Data>TextToColumns, select Delimited>Check the Other box and use an opening parenthesis "(" as the delimiter>on the next screen choose not to import the second column (ie everything after the first parenthesis>Finish.

              Richard

              I know it's more than 3 years later, but just wanted to say thanks, that tip helped me a lot!

              Comment

              Trending

              Collapse

              There are no results that meet this criteria.

              Working...
              X