Solved

How can I remove all spaces following the last character in a cell

Posted on 2013-01-26
4
261 Views
Last Modified: 2013-01-29
How can I remove all spaces following the last character in a cell?  In other words...

"# 264,265 BTMPI, # 266  CLINK                  53 after            "

would end up like...

"# 264,265 BTMPI, # 266  CLINK                  53 after"

(without the quote marks)

--Steve
0
Comment
Question by:SteveL13
  • 2
4 Comments
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
=TRIM(your cell address)
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
Comment Utility
=IF(LEN(TRIM(A1)),REPLACE(LEFT(A1,LOOKUP(2^15,FIND(RIGHT(TRIM(A1)),A1,ROW(INDIRECT("1:"&LEN(A1)))))),1,FIND(LEFT(TRIM(A1)),A1)-1,""),"")

Courtesy barryhoudini
0
 

Author Comment

by:SteveL13
Comment Utility
=TRIM(your cell address)   didn't do anything.  I copied the formula into the space at the top of the spreadsheet as =TRIM(C2) which is the real field I want trimmed and nothing happened other than =TRIM(C2) appeared in cell D2 ???????????


The same thing happens with...   =IF(LEN(TRIM(A1)),REPLACE(LEFT(A1,LOOKUP(2^15,FIND(RIGHT(TRIM(A1)),A1,ROW(INDIRECT("1:"&LEN(A1)))))),1,FIND(LEFT(TRIM(A1)),A1)-1,""),"")

The formula just appears in D2.

I'm sure I'm doing something wrong.
0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 500 total points
Comment Utility
Check this file
Clean-external-spaces.xlsx
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
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…

744 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