Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default UDF/Formula to replace only specific

Dear friends,

Any idea how to desgin a UDF/Formula to replace a character(s) unless some
specific character(s) are preceding?

An example in this regard:

=UDF(A1,"CH","SCH","X") Or
=UDF(A1,B1,C1,D1) with B1:D1 containing the text:
"CH","SCH","X"

in case of an entry in A1, like:

CHECKXCHOWICH

the result comes out to be:

SCHECKXCHOWISCH

because the CH in the mid has an X preceding, it was not replaced but the
two on the sides did change.

Please see if you can help.

Thanx in advance.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default UDF/Formula to replace only specific

Hi,

Try

=SUBSTITUTE(SUBSTITUTE(B1,"CH","SCH"),"XSCH","XCH" )

or enter the arguments in a few cells. This assumes that

CHECKXCHOWICH is in cell B1.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"FARAZ QURESHI" wrote:

Dear friends,

Any idea how to desgin a UDF/Formula to replace a character(s) unless some
specific character(s) are preceding?

An example in this regard:

=UDF(A1,"CH","SCH","X") Or
=UDF(A1,B1,C1,D1) with B1:D1 containing the text:
"CH","SCH","X"

in case of an entry in A1, like:

CHECKXCHOWICH

the result comes out to be:

SCHECKXCHOWISCH

because the CH in the mid has an X preceding, it was not replaced but the
two on the sides did change.

Please see if you can help.

Thanx in advance.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default UDF/Formula to replace only specific

Something like this...

Function CONVERT1(strData, strFind, strReplace, strIgnore)
CONVERT1 = Replace(strData, strFind, strReplace)
CONVERT1 = Replace(CONVERT1, strIgnore & strReplace, strFind)
End Function

If this post helps click Yes
---------------
Jacob Skaria


"FARAZ QURESHI" wrote:

Dear friends,

Any idea how to desgin a UDF/Formula to replace a character(s) unless some
specific character(s) are preceding?

An example in this regard:

=UDF(A1,"CH","SCH","X") Or
=UDF(A1,B1,C1,D1) with B1:D1 containing the text:
"CH","SCH","X"

in case of an entry in A1, like:

CHECKXCHOWICH

the result comes out to be:

SCHECKXCHOWISCH

because the CH in the mid has an X preceding, it was not replaced but the
two on the sides did change.

Please see if you can help.

Thanx in advance.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default UDF/Formula to replace only specific

Wow Pal,

U R simply the Best!!!!!!

Thanx again, Again & AGAIN!

"Jacob Skaria" wrote:

Something like this...

Function CONVERT1(strData, strFind, strReplace, strIgnore)
CONVERT1 = Replace(strData, strFind, strReplace)
CONVERT1 = Replace(CONVERT1, strIgnore & strReplace, strFind)
End Function

If this post helps click Yes
---------------
Jacob Skaria


"FARAZ QURESHI" wrote:

Dear friends,

Any idea how to desgin a UDF/Formula to replace a character(s) unless some
specific character(s) are preceding?

An example in this regard:

=UDF(A1,"CH","SCH","X") Or
=UDF(A1,B1,C1,D1) with B1:D1 containing the text:
"CH","SCH","X"

in case of an entry in A1, like:

CHECKXCHOWICH

the result comes out to be:

SCHECKXCHOWISCH

because the CH in the mid has an X preceding, it was not replaced but the
two on the sides did change.

Please see if you can help.

Thanx in advance.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
replace a range of numbers with specific formatting sg Excel Discussion (Misc queries) 4 August 14th 08 05:58 PM
How can I replace text with a specific number? Emma O''Shaughnessy Excel Discussion (Misc queries) 3 July 3rd 08 12:14 PM
FIND SPECIFIC TEXT AND REPLACE IT Tree Excel Worksheet Functions 5 March 27th 08 12:27 AM
replace or substitute a letter for a specific number El Criollo Excel Discussion (Misc queries) 4 December 7th 06 03:30 PM
replace letter of alfanumeric value by a specific number El Criollo Excel Discussion (Misc queries) 1 December 7th 06 01:09 PM


All times are GMT +1. The time now is 12:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"