Removing single characters

iksotof
3StarLounger
Posts: 315
Joined: 04 May 2010, 15:18

Removing single characters

Post by iksotof »

Hi if I have a random name string with isolated characters like

"adam123 a factory", how can i recomve the solitary a in the middle, without moving the one at that start of adam or indeed in factory?

best and thanks Darren

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Removing single characters

Post by HansV »

In the Replace dialog (Ctrl+H), enter " a " (without the quotes) in the 'Find what' box, and "a " " " (again, without the quotes) in the 'Replace with' box. Then click Replace or Replace All.
Best wishes,
Hans

bknight
BronzeLounger
Posts: 1400
Joined: 08 Jul 2016, 18:53

Re: Removing single characters

Post by bknight »

Wouldn't find space a replaced by space work better?

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Removing single characters

Post by HansV »

That would also remove the a at the beginning of a word:

"It was an accident"

would become

"It was n ccident"
Best wishes,
Hans

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Removing single characters

Post by HansV »

Also, it would leave 2 spaces in the middle when removing the a in iksotof's example.
Best wishes,
Hans

User avatar
StuartR
Administrator
Posts: 12615
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Removing single characters

Post by StuartR »

HansV wrote:
19 Mar 2024, 15:41
In the Replace dialog (Ctrl+H), enter " a " (without the quotes) in the 'Find what' box, and "a " (again, without the quotes) in the 'Replace with' box. Then click Replace or Replace All.
I suspect you meant
In the Replace dialog (Ctrl+H), enter " a " (without the quotes) in the 'Find what' box, and " " (again, without the quotes) in the 'Replace with' box.
Otherwise the a won't be removed, just the space before it!
StuartR


User avatar
SpeakEasy
4StarLounger
Posts: 562
Joined: 27 Jun 2021, 10:46

Re: Removing single characters

Post by SpeakEasy »

For a slightly more generic solution I think I'd favour switching on Wild Card matching ("Use Wildcards"), and then searching for

"<?> " (without the quotes)

And leaving Replace empty

User avatar
DocAElstein
5StarLounger
Posts: 602
Joined: 18 Jan 2022, 15:59
Location: Re-routing rivers, in Hof, Beautiful Bavaria

Re: Removing single characters

Post by DocAElstein »

StuartR wrote:
27 Mar 2024, 11:08
..I suspect you meant
I thought that as well, but I was afraid I had missed something again. I do that sort of find replace often to get rid of words but not when they appear as part of another word.
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(

User avatar
HansV
Administrator
Posts: 78545
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Removing single characters

Post by HansV »

:stupidme: Of course!
Best wishes,
Hans

User avatar
rory
5StarLounger
Posts: 817
Joined: 24 Jan 2010, 15:56

Re: Removing single characters

Post by rory »

Excel doesn't have wildcard matching though (other than in the VBE), unlike Word.
Regards,
Rory

User avatar
SpeakEasy
4StarLounger
Posts: 562
Joined: 27 Jun 2021, 10:46

Re: Removing single characters

Post by SpeakEasy »

Fair point! Missed the fact that I'd dropped into an excel specific topic.

I'd still use ? instead of a for a more generic solution

User avatar
rory
5StarLounger
Posts: 817
Joined: 24 Jan 2010, 15:56

Re: Removing single characters

Post by rory »

Depends on the need, though. If you want to remove " a " but not " I " for example, specific is better than generic. ;)
Regards,
Rory

User avatar
SpeakEasy
4StarLounger
Posts: 562
Joined: 27 Jun 2021, 10:46

Re: Removing single characters

Post by SpeakEasy »

Which is why I labelled it as a generic solution,

iksotof
3StarLounger
Posts: 315
Joined: 04 May 2010, 15:18

Re: Removing single characters

Post by iksotof »

Thank you for the solutions. Sorry for the late acknowledgment, I don't get the opp to drop by much.