Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Defining a Function

Hi, I have a list as follows:

USA--
UK--
JAPAN--

I need to define a function which will return
USA
UK
JAPAN

I have tried the following but I think it needs some tweaking - thks for help

Function taz(x)

Dim i As Long
i = InStr(x, "--")
char = Trim(Left(cell, i - 1))

End Function




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Defining a Function

Try:

Function taz(str as String)
taz = Left(str, Len(str) - 2)
End Function


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"teresa" wrote in message
...
Hi, I have a list as follows:

USA--
UK--
JAPAN--

I need to define a function which will return
USA
UK
JAPAN

I have tried the following but I think it needs some tweaking - thks for
help

Function taz(x)

Dim i As Long
i = InStr(x, "--")
char = Trim(Left(cell, i - 1))

End Function






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Defining a Function

Function taz(x)
Dim i As Long
i = InStr(x, "--")
taz = Trim(Left(x, i - 1))
End Function

assume A1 contains USA--
in B1 put in =taz(A1)

then drag fill down the column.

Or you can select column A and do

Edit=Replace
What --
With leave blank
click replace all.

--
Regards,
Tom Ogilvy


"teresa" wrote in message
...
Hi, I have a list as follows:

USA--
UK--
JAPAN--

I need to define a function which will return
USA
UK
JAPAN

I have tried the following but I think it needs some tweaking - thks for

help

Function taz(x)

Dim i As Long
i = InStr(x, "--")
char = Trim(Left(cell, i - 1))

End Function






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
offset function in defining name BorisS Excel Worksheet Functions 1 May 29th 08 05:35 PM
Help defining a user-defined function LurfysMa New Users to Excel 7 June 10th 07 07:46 AM
Name Defining Chris Excel Discussion (Misc queries) 2 August 10th 06 03:06 PM
Defining Cell namse after they are used in a function Mariano Excel Worksheet Functions 3 January 4th 06 02:54 PM
Defining Matt Excel Discussion (Misc queries) 1 July 26th 05 08:13 PM


All times are GMT +1. The time now is 12:39 PM.

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"