Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Selecting Partial Text in a field

Hi!

I have a question and was hoping someone would be kind enough to help me.

I am trying to select some text within a field separated by tags like: [tag1]

I have tried this formula:
=MID(LEFT(D1,FIND("#", SUBSTITUTE(D1,"[","#",4))-1), FIND("[External",D1)+1,
255)

And it works great, except that some of the text is separated with a
carriage return after [tag1].

i.e.

Instead of [tag1]Blah blah blah

I have:
[tag1]
Blah blah blah

Ultimately, the best way to get this is to pull the text between [tag1] and
[tag2]. How would I go about doing this? If it's not possible, how can I
adapt my equation to accomodate the carriage returns?

Thank you so much for any help!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Selecting Partial Text in a field

On Tue, 6 Feb 2007 07:59:01 -0800, Kanadani
wrote:

Hi!

I have a question and was hoping someone would be kind enough to help me.

I am trying to select some text within a field separated by tags like: [tag1]

I have tried this formula:
=MID(LEFT(D1,FIND("#", SUBSTITUTE(D1,"[","#",4))-1), FIND("[External",D1)+1,
255)

And it works great, except that some of the text is separated with a
carriage return after [tag1].

i.e.

Instead of [tag1]Blah blah blah

I have:
[tag1]
Blah blah blah

Ultimately, the best way to get this is to pull the text between [tag1] and
[tag2]. How would I go about doing this? If it's not possible, how can I
adapt my equation to accomodate the carriage returns?

Thank you so much for any help!


The presence of a carriage return shouldn't make a difference. You can just
use a SUBSTITUTE function to replace it with a <space.

You could use a formula of the type:

=TRIM(SUBSTITUTE(MID(A1,FIND("[tag1]",A1)+
LEN("[tag1]"),FIND("[tag2]",A1)-FIND("[tag1]",A1)-
LEN("[tag1]")),CHAR(10)," "))

This assumes tag1 and tag2 are different. If they are the same, it is still
doable but longer.

OR, you could use regular expressions as available in Longre's free
morefunc.xll add-in at http://xcell05.free.fr

But examples of the actual data and description of the limits would make this
easier to devise.
--ron
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Selecting Partial Text in a field

It worked perfectly! Thank you! You've made me a very, very happy woman. :)

"Ron Rosenfeld" wrote:

On Tue, 6 Feb 2007 07:59:01 -0800, Kanadani
wrote:

Hi!

I have a question and was hoping someone would be kind enough to help me.

I am trying to select some text within a field separated by tags like: [tag1]

I have tried this formula:
=MID(LEFT(D1,FIND("#", SUBSTITUTE(D1,"[","#",4))-1), FIND("[External",D1)+1,
255)

And it works great, except that some of the text is separated with a
carriage return after [tag1].

i.e.

Instead of [tag1]Blah blah blah

I have:
[tag1]
Blah blah blah

Ultimately, the best way to get this is to pull the text between [tag1] and
[tag2]. How would I go about doing this? If it's not possible, how can I
adapt my equation to accomodate the carriage returns?

Thank you so much for any help!


The presence of a carriage return shouldn't make a difference. You can just
use a SUBSTITUTE function to replace it with a <space.

You could use a formula of the type:

=TRIM(SUBSTITUTE(MID(A1,FIND("[tag1]",A1)+
LEN("[tag1]"),FIND("[tag2]",A1)-FIND("[tag1]",A1)-
LEN("[tag1]")),CHAR(10)," "))

This assumes tag1 and tag2 are different. If they are the same, it is still
doable but longer.

OR, you could use regular expressions as available in Longre's free
morefunc.xll add-in at http://xcell05.free.fr

But examples of the actual data and description of the limits would make this
easier to devise.
--ron

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Selecting Partial Text in a field

On Wed, 7 Feb 2007 11:26:00 -0800, Kanadani
wrote:

It worked perfectly! Thank you! You've made me a very, very happy woman. :)


Glad to help. Thanks for the feedback.
--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
How to convert a month to a quarter ...... Epinn New Users to Excel 26 May 3rd 23 07:45 PM
How do I combine text and a calculation in the same field? steshi Excel Worksheet Functions 5 November 20th 06 11:37 AM
Text entries behaving like numbers jkiser Excel Discussion (Misc queries) 12 August 30th 06 09:29 PM
Formulas dealing with text data Bagia Excel Worksheet Functions 6 June 20th 05 10:29 PM
Finding Partial Text in a Cell bob Excel Worksheet Functions 6 December 18th 04 05:03 AM


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