Re: Edit Replace command

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Steve

You only need a few rows to demonstrate what happens.
With 6 "a"s in each cell, carrying out the Edit/Replace it finds 3 sets
of 2, does the replacement and you are left with 3 a's in each cell.
If you carry out the Edit/Replace again, this time it only finds one
occurrence of a double, which gets replaced with a single, and the
result is 2 a's in each cell.
If you did it a third time, then each pair would get replaced with a
single, and all cells would contain a single a.

The behaviour is the same in all versions of XL including XL2007.

--
Regards

Roger Govier


"SteveT" <dev@xxxxxxxxxxxxx> wrote in message
news:uTZuJcruHHA.4572@xxxxxxxxxxxxxxxxxxxxxxx
I don't think you read my post.

I want to know if anyone is finding Replace replaces all occurrences
or does
just one pass and they have to run it again until all the occurences
are
replaced.

It doesn't matter what the character is. To make this simple type the
letter
a 26 times in every cell of one column (do it once and fill down). I
did it
for 30,000 rows.

Choose Edit Replace
Find what: aa
Replace with: a
and click Replace All

On my system there will be more than one a left in each cell but on
another
person's system they will only have one a left in each cell.
I believe in Excel 2000 you had to run it more than once.
I may have a system problem but I would like to know what other people
are
finding, if anyone could do a test.

Thanks,
Steve




"Rick Rothstein (MVP - VB)" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx> wrote
in
message news:Oep1yGnuHHA.4868@xxxxxxxxxxxxxxxxxxxxxxx
I have someone who's Replace command replaces everything in one
pass.
With
mine however I have to repeat the process. This is Excel 2003

An example is lets say you want to replace all occurrences of two
spaces
with one. The first time the Replace command is run it only makes
one
pass
removing only the first found two spaces in each cell. I have to
run the
command several times to replace all occurrences. But the other
person
only has to run it once.

What is the other person replacing and what is he/she replacing it
with?
If
you wanted to replace every occurrence of a double space with
something
that
does not contain a space in it, then one pass is enough. The problem
you
describes does not take into account an odd number of contiguous
spaces.
The
replacement of each pair leaves multiple spaces next to each other at
the
end. Why? Because Replace is not reentrant (it doesn't look back to
see
what
it just created)... it simply looks for the double, space, replaces
it,
and
moves on to the next piece of text after the text it has just
operated on.

Rick





.



Relevant Pages

  • Re: Edit Replace command
    ... I want to know if anyone is finding Replace replaces all occurrences or does ... On my system there will be more than one a left in each cell but on another ... The first time the Replace command is run it only makes one ... What is the other person replacing and what is he/she replacing it with? ...
    (microsoft.public.excel)
  • Re: LG Model 26LX2D LCD TV, Dead
    ... and replacing screws. ... driver with a Li-Ion cell phone battery. ... I'm really surprised at the comments regarding electric screwdrivers. ... I am back to charging them about once a week for the general service work that the driver does daily, and a bit more often when it is being asked to do high torque stuff like driving unpiloted screws into wood. ...
    (sci.electronics.repair)
  • Re: 4 pages wont publish properly
    ... tools/ recalculate hyperlinks. ... then make sure to click the "publish all pages replacing ... republish the site and see how it is. ... > in "code" view and recreating the tables cell by cell but ...
    (microsoft.public.frontpage.client)
  • RE: non-VBA Alternative to SUBTITUTE function
    ... Here's the text in the template, in which I am replacing values inside the ... the values that I am replacing from the brackets come from ... single cell in excel. ...
    (microsoft.public.excel.worksheet.functions)
  • ETA kinetic
    ... while the 920SW is a 1.5 battery. ... is the customer looking at replacing the cell every 6 ... must've cost the customer at least a grand and probably not ...
    (alt.horology)