Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default shortening text in cells

I have numerous emails that have an additional #mailto:blahblahblah on the
end. Is there a way to write a macro or use a formula that would remove
everything starting with the # sign?

For example:

#mailto:Spot

and change to:



Each cell, starting at F2, has a different length of characters after the #.

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default shortening text in cells

Hi srroduin,

There are a few ways you can do this without VBA code:

1) Use Text to Columns: Select Data | Text to Columns, Delimited, put # in
other, Next, select col 2 then select "Do not import column (skip)", Finish.

2) Use a formula like this:

=LEFT(F2,IF(ISERROR(SEARCH("#",F2)),LEN(F2),SEARCH ("#",F2)-1))

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


srroduin wrote:
I have numerous emails that have an additional #mailto:blahblahblah
on the end. Is there a way to write a macro or use a formula that
would remove everything starting with the # sign?

For example:

#mailto:Spot

and change to:



Each cell, starting at F2, has a different length of characters after
the #.

Thanks in advance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default shortening text in cells

Here is another way, but either way you will have to use two cells. Whereas
if you use code then you can loop through your range and edit the contents
and place them in the same cell again.

=MID(A4,1,FIND("#",A4,1)-1)

Chas

"srroduin" wrote:

I have numerous emails that have an additional #mailto:blahblahblah on the
end. Is there a way to write a macro or use a formula that would remove
everything starting with the # sign?

For example:

#mailto:Spot

and change to:



Each cell, starting at F2, has a different length of characters after the #.

Thanks in advance.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default shortening text in cells

On Thu, 10 Aug 2006 14:34:02 -0700, srroduin
wrote:

I have numerous emails that have an additional #mailto:blahblahblah on the
end. Is there a way to write a macro or use a formula that would remove
everything starting with the # sign?

For example:

#mailto:Spot

and change to:



Each cell, starting at F2, has a different length of characters after the #.

Thanks in advance.


Perhaps something like this will get you started:

=============================
Option Explicit
Sub TrimEmail()
Dim c As Range
Dim i As Long

For Each c In Selection
i = InStr(1, c.Text, "#")
If i 0 Then
c = Left(c.Text, i - 1)
End If
Next c
End Sub
=======================


--ron
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default shortening text in cells

Thank you all. It worked great!

"srroduin" wrote:

I have numerous emails that have an additional #mailto:blahblahblah on the
end. Is there a way to write a macro or use a formula that would remove
everything starting with the # sign?

For example:

#mailto:Spot

and change to:



Each cell, starting at F2, has a different length of characters after the #.

Thanks in advance.



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
Shortening pre-existing data in cells in a particular column D.L.T. Excel Discussion (Misc queries) 4 October 12th 07 07:53 PM
Shortening a formula GTVT06 Excel Programming 10 July 20th 06 02:43 AM
Shortening a formula GTVT06 Excel Worksheet Functions 1 July 19th 06 11:21 PM
shortening a macro Aksel Børve Excel Programming 3 June 3rd 05 08:28 PM
shortening a forumula Mike_sharp Excel Discussion (Misc queries) 4 May 4th 05 04:54 PM


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