Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Extract only part of a string

Dear Experts:

I got the following string in a cell:

string,space,string, e.g.: New York Street 7, New York 54334 or
Green Street, 74334 St. Petersburg.


I would like to apply a formula to all these cells so that all the
characters before the comma are cut out and only the string after the
comma is left over, e.g. New York 54334 or 74334 St. Petersburg

Help is much appreciated. Thank you very much in advance.
Regards, Andreas
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Extract only part of a string


If you had the string in cell A1:

=TRIM(RIGHT(A1,LEN(A1)-FIND(",",A1)))


"andreas" wrote:

Dear Experts:

I got the following string in a cell:

string,space,string, e.g.: New York Street 7, New York 54334 or
Green Street, 74334 St. Petersburg.


I would like to apply a formula to all these cells so that all the
characters before the comma are cut out and only the string after the
comma is left over, e.g. New York 54334 or 74334 St. Petersburg

Help is much appreciated. Thank you very much in advance.
Regards, Andreas

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Extract only part of a string

On the off change that some of your text could contain more than one comma,
like for instance...

123 Main St, Apt 4, New York 56789

then you can use this formula to get the text that you want...

=TRIM(RIGHT(SUBSTITUTE(A1,",",REPT(" ",99)),99))

--
Rick (MVP - Excel)


"andreas" wrote in message
...
Dear Experts:

I got the following string in a cell:

string,space,string, e.g.: New York Street 7, New York 54334 or
Green Street, 74334 St. Petersburg.


I would like to apply a formula to all these cells so that all the
characters before the comma are cut out and only the string after the
comma is left over, e.g. New York 54334 or 74334 St. Petersburg

Help is much appreciated. Thank you very much in advance.
Regards, Andreas


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Extract only part of a string

This works for me:
Sub Commas()

'Do Until ActiveCell = ""
For X = 1 To 1
Dim Rng As Range

Set Rng = Range("A1", Range("A100").End(xlUp))
For Each cell In Rng

If cell.Value < "" Then
ActiveCell.Offset(0, 2).Select
ActiveCell.FormulaR1C1 = "=MID(RC[-2],FIND("","",RC[-2]&"","")+2,999)"
ActiveCell.Offset(1, -2).Select
End If

Next cell

Next X
'Loop

End Sub

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Sam Wilson" wrote:


If you had the string in cell A1:

=TRIM(RIGHT(A1,LEN(A1)-FIND(",",A1)))


"andreas" wrote:

Dear Experts:

I got the following string in a cell:

string,space,string, e.g.: New York Street 7, New York 54334 or
Green Street, 74334 St. Petersburg.


I would like to apply a formula to all these cells so that all the
characters before the comma are cut out and only the string after the
comma is left over, e.g. New York 54334 or 74334 St. Petersburg

Help is much appreciated. Thank you very much in advance.
Regards, Andreas

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Extract only part of a string

On Jul 20, 6:24*pm, ryguy7272
wrote:
This works for me:
Sub Commas()

'Do Until ActiveCell = ""
For X = 1 To 1
* * Dim Rng As Range

* * Set Rng = Range("A1", Range("A100").End(xlUp))
* * For Each cell In Rng

* * If cell.Value < "" Then
* * * * ActiveCell.Offset(0, 2).Select
* * * * ActiveCell.FormulaR1C1 = "=MID(RC[-2],FIND("","",RC[-2]&"","")+2,999)"
* * * * ActiveCell.Offset(1, -2).Select
* * End If

* * Next cell

Next X
'Loop

End Sub

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''..



"Sam Wilson" wrote:

If you had the string in cell A1:


=TRIM(RIGHT(A1,LEN(A1)-FIND(",",A1)))


"andreas" wrote:


Dear Experts:


I got the following string in a cell:


string,space,string, e.g.: New York Street 7, New York 54334 or
Green Street, 74334 St. Petersburg.


I would like to apply a formula to all these cells so that all the
characters before the comma are cut out and only the string after the
comma is left over, e.g. New York 54334 or 74334 St. Petersburg


Help is much appreciated. Thank you very much in advance.
Regards, Andreas- Hide quoted text -


- Show quoted text -


Hi, thank you very much for your professional help. Great Stuff.
Regards, Andreas


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Extract only part of a string

On Jul 20, 6:14*pm, "Rick Rothstein"
wrote:
On the off change that some of your text could contain more than one comma,
like for instance...

123 Main St, Apt 4, New York 56789

then you can use this formula to get the text that you want...

=TRIM(RIGHT(SUBSTITUTE(A1,",",REPT(" ",99)),99))

--
Rick (MVP - Excel)

"andreas" wrote in message

...



Dear Experts:


I got the following string in a cell:


string,space,string, e.g.: New York Street 7, New York 54334 or
Green Street, 74334 St. Petersburg.


I would like to apply a formula to all these cells so that all the
characters before the comma are cut out and only the string after the
comma is left over, e.g. New York 54334 or 74334 St. Petersburg


Help is much appreciated. Thank you very much in advance.
Regards, Andreas- Hide quoted text -


- Show quoted text -


Hi Rick,

thank you very much for your professional help. I tried it out and I
keep getting error messages. I have translated the function arguments
into German (having the german version of Excel). Maybe therefore the
errors. I will keep you updated.

Regards, Andreas
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Extract only part of a string

On 20 Jul., 18:14, "Rick Rothstein"
wrote:
On the off change that some of your text could contain more than one comma,
like for instance...

123 Main St, Apt 4, New York 56789

then you can use this formula to get the text that you want...

=TRIM(RIGHT(SUBSTITUTE(A1,",",REPT(" ",99)),99))

--
Rick (MVP - Excel)

"andreas" wrote in message

...



Dear Experts:


I got the following string in a cell:


string,space,string, e.g.: New York Street 7, New York 54334 or
Green Street, 74334 St. Petersburg.


I would like to apply a formula to all these cells so that all the
characters before the comma are cut out and only the string after the
comma is left over, e.g. New York 54334 or 74334 St. Petersburg


Help is much appreciated. Thank you very much in advance.
Regards, Andreas- Zitierten Text ausblenden -


- Zitierten Text anzeigen -


Hi Rick,

Ok, I got it working. Thank you very much for your professional help.
Regards, Andreas
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
Search/Match/Find ANY part of string to ANY part of Cell Value TWhizTom Excel Worksheet Functions 0 July 21st 08 08:16 PM
Extract part of a text string Martin B Excel Worksheet Functions 7 January 13th 08 04:36 PM
How do I extract part of a text string Brennan Excel Discussion (Misc queries) 2 November 28th 06 07:26 PM
Extract part of a Worksheet name. Casey[_118_] Excel Programming 7 July 18th 06 12:20 AM
Extract Part of String [email protected] Excel Worksheet Functions 1 June 9th 05 08:33 AM


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