0

I have a file contains 38,000 records each row contains 2 or more ';' at the end. is there any formula to remove the end repeated ';' in Excel or any other tool for example

3
  • What does this have to do with MySQL? Commented Nov 13, 2018 at 0:45
  • You can search and replace ; in excel Commented Nov 13, 2018 at 0:48
  • 1
    Use a regular expression replacement. Replace ;+$ with ; Commented Nov 13, 2018 at 0:50

1 Answer 1

1

To remove repeated characters (semi-colons in this case)

  1. Hit CTRL+H
  2. Find What: ;; (two semicolons)
  3. Replace with: ; (one semicolon)
  4. Click Replace All. When it finishes, repeat Step 4 until there are no more matches found.

Now the document will have no more than one semicolon in a row.


Remove repeated characters using a VBA function:

The following function does the same thing using VBA, and for any character you choose:

Function removeDoubleChars(txt As String, doubleChar As String) As String
'removes all multiple-consecutive [doubleChar] within [txt]
    Do
        txt = Replace(txt, doubleChar & doubleChar, doubleChar)
    Loop While InStr(txt, doubleChar & doubleChar) > 0
    removeDoubleChars = txt
End Function

You would use this like Range("A1") = removeDoubleChars ( Range("A1"), ";") to remove consecutive semicolons from cell A1.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.