Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default finding last space in a text function

I want to locate the last space in a text string, so that i may reproduce the
string without the characters which occur after the space.

Foe example if i have

"Hydrochloric acid 1M" as the string, i would like to produce "Hydrochloric
acid" from this.

The text string can vary in length as can the final text to be removed

Can anyone help?

Thanks,

Roger

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default finding last space in a text function

On Sun, 20 Jul 2008 18:18:10 -0700, Roger on Excel
wrote:

I want to locate the last space in a text string, so that i may reproduce the
string without the characters which occur after the space.

Foe example if i have

"Hydrochloric acid 1M" as the string, i would like to produce "Hydrochloric
acid" from this.

The text string can vary in length as can the final text to be removed

Can anyone help?

Thanks,

Roger


To get the position of the last space in a string in A1:

=FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),
LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))

To return everything up to the last space:

=LEFT(A1,FIND(CHAR(1),SUBSTITUTE(A1," ",CHAR(1),
LEN(A1)-LEN(SUBSTITUTE(A1," ",""))))-1)

--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help finding the last space in a cell [email protected] Excel Worksheet Functions 2 January 28th 09 05:58 PM
Finding (and eliminating) hidden "space" character smartgal Excel Discussion (Misc queries) 8 October 31st 08 03:45 AM
Space in text Raj Excel Discussion (Misc queries) 2 May 11th 08 01:34 AM
Space after Mid Function David Excel Discussion (Misc queries) 8 July 27th 06 02:25 PM
Function to remove a space from text in cell WITHOUT macro?? [email protected] Excel Worksheet Functions 5 May 28th 05 02:28 AM


All times are GMT +1. The time now is 02:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"