Remove specific text from a column of cells

G

Guest

Example:

Apple and Pear Oct 2,2006
Orange and Lime Oct 30,2006
Pear and Pineapple Oct 6, 2006

I want to remove the date at the end of each cell. Can someone help? Thank
you.
 
D

Don Guillett

One TOO simple way would be to have a helper column
=left(a2,len(a2)-11)
Leaves a space on the single digit but probably doesn't matter.
 
B

Biff

Based on your samples the date appears after the 3rd space. If that's
consistent within your data:

=LEFT(A1,FIND("~",SUBSTITUTE(A1," ","~",3))-1)

Biff
 
G

Guest

Try Edit, Replace, and in Find What type in Oct * Then click on Replace
or Replace All at the bottom.

Carole O
 
G

Guest

My previous posting will only remove Oct data. If the text has an aribtrary
number of words and the date is always the last three words in the cell then
this little UDF will remove then:

Function sweepea(s As String) As String
ss = Split(s, " ")
For i = 0 To UBound(ss) - 3
sweepea = sweepea & ss(i) & " "
Next
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top