Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Jordan
 
Posts: n/a
Default finding char within a cell

I posted this a while ago and it never showed up. I apoligize if it
duplicates itself.

I have a list of account numbers in column A.

JOR123
1234
567US/789US
PB34-7890

I need the text or numbers before the - or the / I am using the find
function to get the poistion along with the right function to pull out the
info. The problem is I dont know how to look for the - or the /. I can only
do one or the other.

Thanks for your help



  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way:

=LEFT(A1,FIND("/",SUBSTITUTE(A1,"-","/"))-1)

or if you need to take all of the number if there is no / or -:

=IF(ISERR(FIND("/",SUBSTITUTE(A8,"-","/"))),A8,
LEFT(A8,FIND("/",SUBSTITUTE(A8,"-","/"))-1))

In article ,
Jordan wrote:

I posted this a while ago and it never showed up. I apoligize if it
duplicates itself.

I have a list of account numbers in column A.

JOR123
1234
567US/789US
PB34-7890

I need the text or numbers before the - or the / I am using the find
function to get the poistion along with the right function to pull out the
info. The problem is I dont know how to look for the - or the /. I can only
do one or the other.

  #3   Report Post  
Domenic
 
Posts: n/a
Default

Another way...

=IF(OR(ISNUMBER(SEARCH({"/","-"},A1))),LEFT(A1,MIN(SEARCH({"/","-"},A1&"/
-"))-1),A1)

Hope this helps!

In article ,
Jordan wrote:

I posted this a while ago and it never showed up. I apoligize if it
duplicates itself.

I have a list of account numbers in column A.

JOR123
1234
567US/789US
PB34-7890

I need the text or numbers before the - or the / I am using the find
function to get the poistion along with the right function to pull out the
info. The problem is I dont know how to look for the - or the /. I can only
do one or the other.

Thanks for your help

  #4   Report Post  
Harlan Grove
 
Posts: n/a
Default

Domenic wrote...
Another way...

=IF(OR(ISNUMBER(SEARCH({"/","-"},A1))),LEFT(A1,MIN(SEARCH({"/","-"},
A1&"/-"))-1),A1)

....

If you're going to append "/" and "-" to A1, there's no need for the
error trap.

=LEFT(A1,MIN(FIND({"-","/"},A1&{"-","/"}))-1)

  #5   Report Post  
Domenic
 
Posts: n/a
Default

Ahh yes... Thanks Harlan!

In article . com,
"Harlan Grove" wrote:

Domenic wrote...
Another way...

=IF(OR(ISNUMBER(SEARCH({"/","-"},A1))),LEFT(A1,MIN(SEARCH({"/","-"},
A1&"/-"))-1),A1)

...

If you're going to append "/" and "-" to A1, there's no need for the
error trap.

=LEFT(A1,MIN(FIND({"-","/"},A1&{"-","/"}))-1)

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
Function syntax to compare cell contents ES Excel Worksheet Functions 2 May 18th 05 03:53 PM
up to 7 functions? ALex Excel Worksheet Functions 10 April 12th 05 06:42 PM
Syntax for inferred cell references donesquire Excel Worksheet Functions 4 April 4th 05 09:29 PM
inserting data from a row to a cell, when the row number is specified by a formula in a cell [email protected] New Users to Excel 2 January 6th 05 07:18 AM
VLookup resulting in a blank cell... KempensBoerke Excel Worksheet Functions 1 October 28th 04 09:57 PM


All times are GMT +1. The time now is 12:36 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"