Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Josh Craig
 
Posts: n/a
Default Use a formula to delete part of a text string?

Hi I was just wondering if I could use a formula to delete part of text in a
cell after a certain string of text appears within that cell where the number
of characters before the certain text varies for example:

Big Fat Cat-brown-2803
Small dog-brown-705
Large sheep-brown-106
Small cat-brown-1803

I was looking for a formula so that everything after "-brown" and "-brown"
itself is is deleted. I can only think how to do this where there is a
consistent number of characters before or after the phrase I want to delete,
but unfortunately I don't have that luxury.

Any advice would be greatly appreciated!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Stefi
 
Posts: n/a
Default Use a formula to delete part of a text string?

Say your text is in A2, then insert in B2:
=LEFT(A2,SEARCH("-brown",A2)-1)

Regards,
Stefi

€˛Josh Craig€¯ ezt Ć*rta:

Hi I was just wondering if I could use a formula to delete part of text in a
cell after a certain string of text appears within that cell where the number
of characters before the certain text varies for example:

Big Fat Cat-brown-2803
Small dog-brown-705
Large sheep-brown-106
Small cat-brown-1803

I was looking for a formula so that everything after "-brown" and "-brown"
itself is is deleted. I can only think how to do this where there is a
consistent number of characters before or after the phrase I want to delete,
but unfortunately I don't have that luxury.

Any advice would be greatly appreciated!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bondi
 
Posts: n/a
Default Use a formula to delete part of a text string?


Josh Craig wrote:
Hi I was just wondering if I could use a formula to delete part of text in a
cell after a certain string of text appears within that cell where the number
of characters before the certain text varies for example:

Big Fat Cat-brown-2803
Small dog-brown-705
Large sheep-brown-106
Small cat-brown-1803

I was looking for a formula so that everything after "-brown" and "-brown"
itself is is deleted. I can only think how to do this where there is a
consistent number of characters before or after the phrase I want to delete,
but unfortunately I don't have that luxury.

Any advice would be greatly appreciated!


Hi,

One way would to use something like this: (With text in A1)

=LEFT(A1,LEN(A1)-SEARCH("-brown",A1,1))

Regards,
Bondi

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bondi
 
Posts: n/a
Default Use a formula to delete part of a text string?

Hi Again,

Sorry.. disregard all the stuff i just wrote... It is compleat rubish
:)
Stefi's works like a charm thou..

Regards,
Bondi

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Biff
 
Posts: n/a
Default Use a formula to delete part of a text string?

Hi!

Try this:

Select the range of cells in question.
Goto DataText to Columns
Select Delimited
Next
Select Other and in the little box to the right enter - (enter a dash)
Next
Click inside the column where it shows all the browns
Then select Do not import column (skip)
Do the same thing for the next column to the right
Finish

Biff

"Josh Craig" wrote in message
...
Hi I was just wondering if I could use a formula to delete part of text in
a
cell after a certain string of text appears within that cell where the
number
of characters before the certain text varies for example:

Big Fat Cat-brown-2803
Small dog-brown-705
Large sheep-brown-106
Small cat-brown-1803

I was looking for a formula so that everything after "-brown" and "-brown"
itself is is deleted. I can only think how to do this where there is a
consistent number of characters before or after the phrase I want to
delete,
but unfortunately I don't have that luxury.

Any advice would be greatly appreciated!



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
Find & Replace text format jmn13 Excel Discussion (Misc queries) 2 May 25th 06 06:18 PM
Return a formula as text string to a cell Sharon Excel Worksheet Functions 4 April 18th 06 05:40 PM
Formula to strip figures from cells text strings mikeburg Excel Discussion (Misc queries) 5 August 15th 05 10:31 PM
Need macro to insert text string while inside cell (formula) BrianB Excel Discussion (Misc queries) 0 May 31st 05 03:18 PM
Delete part of a formula dee Excel Discussion (Misc queries) 6 April 28th 05 01:28 AM


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