Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using substitute to replace text that varies

I'd like some assistance with using substitute. I need to look for
any phrase, for example:

X123X and replace the X with Y so that it becomes Y123Y
or
XAB1278X and replace the X with Y to become YAB1278Y

As you can see... the number of characters between the two X's can
vary. Is substitute able to have 'wildcard' symbols to denote that it
needs to look for any number of text before the 2nd X?

I cannot do a blanket search/replace for X to be replaced with Y as it
will affect other things.

If substitute isn't the right command to use... what would you
suggest?

Hope what I'm asking for is clear...

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using substitute to replace text that varies


substitute is the right command but you must ommit the last parameter
'Instance_num'

i.e.:

=SUBSTITUTE(A1;"X";"Y")

This will replace all X by Y in the text


--
schuurke28
------------------------------------------------------------------------
schuurke28's Profile: http://www.excelforum.com/member.php...o&userid=15818
View this thread: http://www.excelforum.com/showthread...hreadid=273154

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using substitute to replace text that varies

If this is a programming question

activeCell.Value = Application.Substitute(ActiveCell.Value,"X","Y")

or if using xl2000 or later (use the replace function)
activeCell.Value = Replace(ActiveCell.Value,"X","Y")

--
Regards,
Tom Ogilvy



"HJ" wrote in message
om...
I'd like some assistance with using substitute. I need to look for
any phrase, for example:

X123X and replace the X with Y so that it becomes Y123Y
or
XAB1278X and replace the X with Y to become YAB1278Y

As you can see... the number of characters between the two X's can
vary. Is substitute able to have 'wildcard' symbols to denote that it
needs to look for any number of text before the 2nd X?

I cannot do a blanket search/replace for X to be replaced with Y as it
will affect other things.

If substitute isn't the right command to use... what would you
suggest?

Hope what I'm asking for is clear...

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using substitute to replace text that varies



Thanks for the help with using substitute.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Keep text matching a wildcard spec in replace/substitute Hershmab Excel Worksheet Functions 3 September 12th 09 08:28 PM
Substitute/Replace Viktor Ygdorff Charts and Charting in Excel 0 July 17th 06 12:37 PM
Replace or Substitute for COMBIN function Jaja Excel Discussion (Misc queries) 6 January 1st 06 02:18 PM
merged cells into one text cell, size varies dependant on text dat Jazzylady825 Excel Discussion (Misc queries) 0 December 9th 05 08:26 PM
Substitute ,replace and delete in a cell. Doug Excel Worksheet Functions 2 November 9th 05 03:50 PM


All times are GMT +1. The time now is 11:18 PM.

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"