Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Left() Need the equivalent of this

In Access 2003 to get a word before the " / " from Smith/Jones you use
the following code:

IIf([Team1] Is Null,"",Left([Team1],InStr([Team1],"/")-1))

What would the equivalent of this in an Excel spreadsheet? I want to have
the field blank if there is no data in the field.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Left() Need the equivalent of this

One way:

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


In article ,
"Presto" wrote:

In Access 2003 to get a word before the " / " from Smith/Jones you use
the following code:

IIf([Team1] Is Null,"",Left([Team1],InStr([Team1],"/")-1))

What would the equivalent of this in an Excel spreadsheet? I want to have
the field blank if there is no data in the field.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Left() Need the equivalent of this

Hi,

I don't know of any circumstance in which your formula would return the
first word and am not sure if you mean Vb or worksheet so here's both

vb
mystring = Left(Range("A1"), InStr(Range("A1"), "/") - 1)

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

Mike

"Presto" wrote:

In Access 2003 to get a word before the " / " from Smith/Jones you use
the following code:

IIf([Team1] Is Null,"",Left([Team1],InStr([Team1],"/")-1))

What would the equivalent of this in an Excel spreadsheet? I want to have
the field blank if there is no data in the field.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Left() Need the equivalent of this

Actually , it's really cool that you posted both. Kudos!

However, Mr McGimpsey included the If statement which is exactly what I
needed.... so he wins!

Thanks to you both. You pointed me in the right direction! :)


"Mike H" wrote in message
...
Hi,

I don't know of any circumstance in which your formula would return the
first word and am not sure if you mean Vb or worksheet so here's both

vb
mystring = Left(Range("A1"), InStr(Range("A1"), "/") - 1)

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

Mike

"Presto" wrote:

In Access 2003 to get a word before the " / " from Smith/Jones you
use
the following code:

IIf([Team1] Is Null,"",Left([Team1],InStr([Team1],"/")-1))

What would the equivalent of this in an Excel spreadsheet? I want to have
the field blank if there is no data in the field.







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Left() Need the equivalent of this

OK, I'm stuck again.
I was trying to use the same logic for MID, to get everything AFTER the /
but it's not working. I only get the / as a result.
I'm using : =IF(E3="", "", MID(E3,FIND("/", E3),1))

=FIND("/",E3) will result in the position of the slash - I understand that
.....
Whats wrong with this picture?


"Presto" wrote in message
...
Actually , it's really cool that you posted both. Kudos!

However, Mr McGimpsey included the If statement which is exactly what I
needed.... so he wins!

Thanks to you both. You pointed me in the right direction! :)


"Mike H" wrote in message
...
Hi,

I don't know of any circumstance in which your formula would return the
first word and am not sure if you mean Vb or worksheet so here's both

vb
mystring = Left(Range("A1"), InStr(Range("A1"), "/") - 1)

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

Mike

"Presto" wrote:

In Access 2003 to get a word before the " / " from Smith/Jones you
use
the following code:

IIf([Team1] Is Null,"",Left([Team1],InStr([Team1],"/")-1))

What would the equivalent of this in an Excel spreadsheet? I want to
have
the field blank if there is no data in the field.











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Left() Need the equivalent of this

On Wed, 3 Dec 2008 20:15:56 -0500, "Presto"
wrote:

OK, I'm stuck again.
I was trying to use the same logic for MID, to get everything AFTER the /
but it's not working. I only get the / as a result.
I'm using : =IF(E3="", "", MID(E3,FIND("/", E3),1))

=FIND("/",E3) will result in the position of the slash - I understand that
....
Whats wrong with this picture?


You are only returning 1 character.
Look at HELP for the MID function, or check out the prompts as you enter the
formula:

Try:

=IF(E3="", "", MID(E3,FIND("/", E3)+1,255))

The +1 tells the MID function to start returning characters at the position
that is 1 after the "/". The 255 needs to be some value greater than the
length of the rest of the string.
--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
LEFT function-all to left of a comma? Jennifer F Excel Worksheet Functions 1 January 21st 09 11:19 PM
when inserting new worksheets they read right to left not left to. Andy Setting up and Configuration of Excel 2 December 3rd 08 09:51 PM
How to make a cell appear in upper left (top left) corner of works jeff Excel Programming 2 March 6th 07 10:14 PM
Column labels run right to left, not left to right tmassey Excel Discussion (Misc queries) 1 November 10th 06 11:03 AM
How to change the right-to-left worksheet to left-to-right workshe RAMA Excel Discussion (Misc queries) 1 July 4th 05 01:57 PM


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