find a pattern in string and remove that pattern of the string from excel cells without touching the pattern in the middle of the string

mohi

I have a column which has "--" pattern in the beginning, middle and end of the string. For example:

-- myString
my -- String
myString -- 

I want to find these two types of cells

-- myString
myString --

and remove the "--" pattern, so it will look fine! I am an amateur user of excel but can use functions if you suggest me. It should be possible with find and use the results of the Find in Replace functions, but I do not know how to pass the results to Replace.

Please note: The answer should take care all the cells in the column, which are hundreds. One solution for changing all, not one solution for one cell.

mohi

OK, I found the answer. The answer from @Dubison helped me to find the right answer. If the left two characters in this cell is "--" and the last two characters are "--" the substitute the "--" with "", else to nothing.

=IF(LEFT(A1,2)="--",SUBSTITUTE(A1,"--",""),IF(RIGHT(A1,2)="--",SUBSTITUTE(A1,"--",""), A1)) 

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Regex, find pattern only in middle of string

From Dev

Remove specific pattern from string

From Dev

Remove specific pattern from string

From Dev

Pattern Remove from string php

From Dev

Remove a string pattern and symbols from string

From Dev

Find string match pattern

From Dev

Python: Find pattern in a string

From Dev

String pattern find character

From Dev

Find String Pattern in Java

From Dev

Find string pattern

From Dev

Is there a Lua string.find without pattern

From Java

Remove pattern from beginning of string using only Bash pattern matching

From Dev

java - Extract current date pattern from a String without knowing the pattern

From Dev

Remove specified pattern from string in R

From Dev

How to remove a pattern from a string using Regex

From Dev

Remove substring/pattern word from a string

From Dev

How to remove a specific pattern from a string in R?

From Dev

Remove substring/pattern word from a string

From Dev

How to remove a specific pattern from a string in R?

From Dev

Remove regex pattern from string and store in csv

From Dev

Remove specified pattern from string in R

From Dev

Extracting date from a string without pattern

From Dev

Remove string with sed in pattern with numbers

From Dev

Find a pattern within' long string

From Dev

Find and Replace a pattern of string in java

From Dev

Regular Expressions: Find pattern in string

From Dev

search for pattern in string and echo if find it

From Dev

Find all indices of pattern in string?

From Dev

find match pattern in string object