Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 27
Default return a text that is before "/"

Dear All,

I have tried MID, FIND, LEFT function but to no avail as the length of a
string can vary:

97/2008
98/2008
99/2008
108/2008
109/2008
495/2008
496/2008
CORRECTION 3/2008
498/2008


What I need to achieve is to have a function that will return everything
before "/" and without any "space" at the end: e.g. it will return 498 only
without emtpy space (something like TRIM).

Any help appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default return a text that is before "/"

a function that will return everything before "/" ..
For the above, this will return it as text/text nums
In B1, copied down: =LEFT(A1,SEARCH("/",A1)-1)

If "CORRECTION" is the only text that might be embedded within, and you need
it returned as real numbers (ie nums before the "/"), try in B1, copied down:
=LEFT(SUBSTITUTE(A1,"CORRECTION",""),SEARCH("/",SUBSTITUTE(A1,"CORRECTION",""))-1)+0
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:22,500 Files:370 Subscribers:66
xdemechanik
---
"Piotr (Peter)" wrote:
I have tried MID, FIND, LEFT function but to no avail as the length of a
string can vary:

97/2008
98/2008
99/2008
108/2008
109/2008
495/2008
496/2008
CORRECTION 3/2008
498/2008


What I need to achieve is to have a function that will return everything
before "/" and without any "space" at the end: e.g. it will return 498 only
without emtpy space (something like TRIM).

Any help appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 27
Default return a text that is before "/"

Thanks a lot Max. That did it:))

"Max" wrote:

a function that will return everything before "/" ..

For the above, this will return it as text/text nums
In B1, copied down: =LEFT(A1,SEARCH("/",A1)-1)

If "CORRECTION" is the only text that might be embedded within, and you need
it returned as real numbers (ie nums before the "/"), try in B1, copied down:
=LEFT(SUBSTITUTE(A1,"CORRECTION",""),SEARCH("/",SUBSTITUTE(A1,"CORRECTION",""))-1)+0
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:22,500 Files:370 Subscribers:66
xdemechanik
---
"Piotr (Peter)" wrote:
I have tried MID, FIND, LEFT function but to no avail as the length of a
string can vary:

97/2008
98/2008
99/2008
108/2008
109/2008
495/2008
496/2008
CORRECTION 3/2008
498/2008


What I need to achieve is to have a function that will return everything
before "/" and without any "space" at the end: e.g. it will return 498 only
without emtpy space (something like TRIM).

Any help appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default return a text that is before "/"

Welcome, glad it did.
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:22,500 Files:370 Subscribers:66
xdemechanik
---
"Piotr (Peter)" wrote in message
...
Thanks a lot Max. That did it:))



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
can lookup return cell reference istead of "text" for sumif? [email protected] Excel Worksheet Functions 1 April 26th 08 03:23 PM
IF cells(row,column) contain "this word" ??? Then return text meiftan New Users to Excel 1 January 11th 08 03:01 AM
Check if cells contain the word "Thailand", return "TRUE" ali Excel Worksheet Functions 7 September 14th 07 09:53 AM
Disabling "wrap text" neuters alt-return line feeds within cell [email protected] Excel Discussion (Misc queries) 2 August 21st 06 04:49 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM


All times are GMT +1. The time now is 09:24 AM.

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

About Us

"It's about Microsoft Excel"