[Solved] Any way to remove numbers from cell, leaving text

Discuss the spreadsheet application
Post Reply
fatgreta
Posts: 53
Joined: Sat Feb 26, 2011 1:59 am

[Solved] Any way to remove numbers from cell, leaving text

Post by fatgreta »

Hi,

So I have a number of cells in spreadsheet that look like these (each line below is a single cell). They are all in a single column (C)

0130 CVS/PHARMACY #00447 CVS/PHARMACY #00447 NORTHAMPTON MA
0204 PGI*WHATEVER WORKS PGI*WHATEVER WORKS 8777565053 MA
0209 CUP AND TOP CAFE CUP AND TOP CAFE FLORENCE MA

I'm wondering if it's possible to do any of the following things:

1) Automatically search all the cells in column C and remove any number that appears. So the first line above would read like this:

CVS/PHARMACY # CVS/PHARMACY # NORTHAMPTON MA

2) Automatically search the entire spreadsheet and remove any instance of four consecutive numbers, which start with 0. So, the above lines would read like this:

CVS/PHARMACY #00447 CVS/PHARMACY #00447 NORTHAMPTON MA
PGI*WHATEVER WORKS PGI*WHATEVER WORKS 8777565053 MA
CUP AND TOP CAFE CUP AND TOP CAFE FLORENCE MA


That way if I sort by Column C the sort will be more accurate.

Thanks for any help, I realize this is a long shot.

Chris
Last edited by Hagar Delest on Tue Oct 11, 2016 9:44 pm, edited 1 time in total.
Reason: tagged [Solved].
Open Office 4.1.7 on Windows 10
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Any way to remove numbers from cell, leaving text

Post by acknak »

Remove all numbers (runs of one or more digits):

1) Select the cells you want to change
2) Edit > Find & Replace
Search for: \d+
Replace with: empty
Options/Current selection only: ON
Options/Regular expressions: ON

Click Replace All

Remove numbers at the start:

1) Select the cells you want to change
2) Edit > Find & Replace
Search for: ^\d+\s*
Replace with: empty
Options/Current selection only: ON
Options/Regular expressions: ON

Click Replace All
AOO4/LO5 • Linux • Fedora 23
User avatar
JohnSUN-Pensioner
Volunteer
Posts: 876
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Any way to remove numbers from cell, leaving text

Post by JohnSUN-Pensioner »

Also, you can use the tool Data - Text to Columns in the "Fixed width" mode.
Measure out the first five characters and mark the resulting column "Hide"
Remove some digits.png
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
fatgreta
Posts: 53
Joined: Sat Feb 26, 2011 1:59 am

Re: Any way to remove numbers from cell, leaving text

Post by fatgreta »

Thank you both very much! I used each of your suggestions for different parts of my project and they both saved me a great deal of time.

Many thanks,

fatgreta (Chris)
Open Office 4.1.7 on Windows 10
Post Reply