Search and Replace Destroys All Formatting?!

Copper Contributor


Hello, All.  I am shocked by this  "Search and Replace" behavior. 

 

In a new spreadsheet,

1. Type "This is a test" in a cell.
2. Italicize the word "test".
3. Save the file.
4. Search and replace the word "This" with the word "That."

The italics of the word "test" -- which should be unaffected since that word was not searched and replaced -- is removed. This also happens with bold, underline, font, and point size. In fact, no matter how much text is in the cell, all formatting everywhere in the cell is wiped out by a simple search and replace of anything anywhere in the cell.

Is there a way to search and replace an unformatted word with another unformatted word without wiping out all formatting in the cell?  And if you search and replace anything that appears in every cell, without wiping out all formatting in the entire spreadsheet!? 

Thanks.  I am on a MacBook Air 2011 running Excel for Mac 16.52 in a Microsoft 365 Subscription. But I have asked others running PCs and other Excel versions to try this test and they all report the same behavior. 

6 Replies

@Elizur In-cell formatting has always been fragile and cumbersome if you ask me. I hardly ever use it. That being said, Excel is not a word processor, it is a calculation engine.
What would you do when the searched string has mixed formatting, like 'these words' in this string:

"I was looking for these words"

@Jan Karel Pieterse 

 

Jan, I acknowledge that Excel is numbers-oriented and I do not expect Excel to be as word processing functional as, say, Word.  But OTOH, I certainly do expect Excel -- an extremely widespread, longstanding product by a major software company, which has gone through umpteen revisions -- to have ironed out major bugs in the limited word processing functions it does offer.  [i.e., "first, do no harm.]  Since Excel offers "search and replace" of selected text, that function should work without damaging other text.  Who would think that searching and replacing one word would wipe out all formatting everywhere in all text in all cells containing that word, including text that was not to be searched and replaced?   And I can't believe that I, a non-technical person who has used Excel lightly for decades, would be the one to discover that it does.  Surely, Excel engineers have long known about that rather fundamental search and replace bug, but not fixed it. 

 

As to your question, my version of Excel (Microsoft 365 subscription) does not allow me to indicate the formatting of a searched term, so I couldn't search and replace by font.  It entirely disregards the lack or presence of formatting when it searches and replaces.   So, had I wanted to change the formatting in a word anywhere or everywhere, I believe I would have had to search for each occurrence of that word and change it manually where desired.  But again, my problem is that I searched and replaced one word and it replaces all types of formatting throughout the entire cell -- not "just" in the searched and replaced term. 

I just ran into the the same thing today - but on Windows. As you said in a reply, it is a surprisingly obvious bug to get out in the first place; but to still be unfixed a year after being reported is not a good impression for Microsoft.
I'm afraid this is something that Microsoft would call "By design". Search and replace has never retained the formatting of the individual characters in a cell. If you would like the Excel team to change that behavior, you can go to the Help tab, click the feedback button and then click the "I have a suggestion" button.
Given it changes the formatting for words and characters that were not involved in the replace, it does seem like it would be a rather strange intentional design choice though. Imho, it feels like a pretty obvious bug. Regardless, I suppose only the Excel team know for sure - thank you for the tip on how to provide more direct feedback!
I would not count on the Excel team knowing the why, this is very, very ancient behavior of Excel. It probably goes back to when S&R was introduced way back when :)