Solved

Excel function to remove/edit strings in a column

Posted on 2011-02-25
14
199 Views
Last Modified: 2012-05-11
In the location column,
I have the following data displayed..

666666 Railroad
666666  Trains
666666  Buses
....
Id like to edit the data in that column to remove the trailing text..Railroad,Trains and Buses
It would be cumbersome to go to its line and manulally remove it. What's excel trick to to do?
0
Comment
Question by:zachvaldez
  • 5
  • 5
  • 4
14 Comments
 
LVL 50

Expert Comment

by:barry houdini
ID: 34981040
If you want to get rid of everything after the space do an "Edit/Replace" replacing

[space][asterisk]

with nothing

regards, barry
0
 
LVL 14

Assisted Solution

by:sungenwang
sungenwang earned 100 total points
ID: 34981058
You can put this formula to the right of each cell and copy down:
=LEFT(A2,FIND(" ",A2))

This will remove all the text after (and include) the space.
Then you do a paste value.

sew
0
 

Author Comment

by:zachvaldez
ID: 34981123
what do you mean by
"to the right of each cell and copy down"
thanks
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 34981150
Did you try the Edit > Replace?

That will amend the data in situ rather than having to create another column......

barry
0
 
LVL 14

Expert Comment

by:sungenwang
ID: 34981168
If you have the location column in A, then put the formula to column B, then copy the formula down. See attached workbook.

sew

Book1.xls
0
 

Author Comment

by:zachvaldez
ID: 34981231
I use 2010.
0
 
LVL 14

Expert Comment

by:sungenwang
ID: 34981290
try this one... same formula will work.

also, don't forget to "copy value" to the entire output column. this way it will get rid of the formula and replace it with the new value.

sew

Book1.xlsx
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:zachvaldez
ID: 34981392
wihtout readiing the last post, I tried to delete the original column and I got error because the values refeence the original cells. so it had to be absolute values when pasted.
0
 
LVL 14

Expert Comment

by:sungenwang
ID: 34981424
before deleting the original column, do this first:

1. highlight the entire output column, right click and select Copy
2. right click and select Paste Special
3. check Value and OK

then you can delete the original column.

sew

0
 
LVL 50

Expert Comment

by:barry houdini
ID: 34981635
If you use the method I suggested then you don't need an additional column it just deleted all unwanted data in one shot - do you need help to implement?

barry
0
 

Author Comment

by:zachvaldez
ID: 34982289
barry how to do that with 2010 version
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 150 total points
ID: 34982452
Select the column with your text then on "Home" tab, all the way to the right hand side of the ribbon, select "Find and Select" then from the menu "Replace".

In the "Find what" box you need to put a space followed by an asterisk (*), just those two characters, levae the "Replace with" box empty.

Select "Replace All" > OK > Close

regards, barry
0
 

Author Comment

by:zachvaldez
ID: 34984998
What if text trailing the numbers have more than 1 space in between
Like
66666 Railroad Trans
So here for example has 2 spaces...
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 34985072
Using my suggestion will remove everything including and after the first space so you'd be left with just the number, 66666, is that what you want?

If there are no spaces in a cell then it won't change.

Did you try it?

regards, barry
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now