Solved

How can I remove blank spaces in Excel?

Posted on 2002-03-21
3
4,109 Views
Last Modified: 2008-03-17
I have a very large file I imported into Excel but am having problems sorting it because many entries in cells begin with a space. How can I mass remove these unwanted spaces?
0
Comment
Question by:RAE
3 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 6887205
Hi RAE,

-lets say data start at row 2
-you can insert a column in front of the offending column say column A which will then become the B column
-then add this formula =LTRIM(B2) to the new column in A2
-now copy this formula down till the end of the column to trim
-to round it up select column A completely choose copy
-then goto the second column choose paste special | only values
-then delete the first column again

be sure to make a copy first of this sheet but it will work like this

HTH:Bruintje
0
 
LVL 5

Accepted Solution

by:
jklmn earned 100 total points
ID: 6887233
Hi RAE,

If you don't mind using VBA, you can select the range with the data in your sheet and run this simple code:

Sub Trim()
For Each acell In Selection.Cells
acell.Value = LTrim(acell.Value)
Next
End Sub
0
 

Author Comment

by:RAE
ID: 6887287
Thanks very much! It worked very well. (When I tried bruintje version I kept getting a #NAME? error)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction Perhaps more familiar to developers who primarily use VBScript than to developers who tend to work only with Microsoft Office and Visual Basic for Applications (VBA), the Dictionary is a powerful and versatile class, and is useful …
In case Office 2010 has not been deployed in your environment, this article may be quite useful. In our office, we wanted a way to deploy Microsoft Office Professional Plus 2010 through an automated batch file via logon script. This article is docum…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

813 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

21 Experts available now in Live!

Get 1:1 Help Now