How can delete the duplicate word from a string in cell in EXCEL
You can use a custom formula, using the regular expression component from
vbscript (it should be installed in your computer by default)
Open the Visual Basic Editor (Alt+11), create a new module (menu Insert -
Module) and paste the following:
Function RemoveDup(str1)
Dim regEx
Set regEx = CreateObject("vbscript.regexp")
regEx.Global = False
regEx.Pattern = "\b(\w+)\b\s+\1"
regEx.IgnoreCase = True
RemoveDup = regEx.Replace(str1, "$1")
End Function
Then you can use this function in your workbook, just typing =RemoveDup(A1),
for example.
The formula will remove the first repeated word, for removing all repeated
words change the line with regEx.Global = False to regEx.Global = True.
Hope this helps,
Miguel.
"Laxman A Patil" wrote:
How we can delete the duplicate word from a string from a particular cell in
EXCEL
|