Replace pattern of characters
On Wed, 21 Mar 2007 13:54:16 -0400, Ron Rosenfeld
wrote:
On Wed, 21 Mar 2007 10:44:20 -0700, Fernando
wrote:
I need replace the contents of a column as follows
The column will have have empty rows rows with 4 characters and rows with
8 characters.
For the rows with 8 characters I need to insert a "/' in between.
e.g.
XXXXWWWW - XXXX/WWWW.
I know I can use ???????? in the search, but how do I get the replace to
only insert the "/" in between the characters?
The first four characters are not always the same.
Thank you for your help
JFercan.
You could use a formula:
=IF(LEN(A1)=8,LEFT(A1,4)&"/"&RIGHT(A1,4),A1)
Otherwise, you would probably have to use a VBA macro to change the cell
contents "in place".
--ron
That should be:
=IF(A1="","",IF(LEN(A1)=8,LEFT(A1,4)&"/"&RIGHT(A1,4),A1))
--ron
|