View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Lars-Åke Aspelin[_2_] Lars-Åke Aspelin[_2_] is offline
external usenet poster
 
Posts: 913
Default Split data around a carriage return

On Fri, 22 Jan 2010 13:10:04 -0800, xp
wrote:

I have a column of data. In each row, is carriage return character in the
middle of some data. The carriage return is never in the same position and
the text is different lengths on each row.

I need to split this data into two columns with the data to the left of the
carriage return in one column and the data to the right of the carriage
return in another column and leave out the carriage return altogether.

Can anyone help me out with a solution to this? I can code or use formulas
or even a built in command if there is one...thanks!


If your data is in column A starting on row 1, try this:

In cell B1:
=LEFT(A1,FIND(CHAR(13),A1)-1)

In cell C1:
=RIGHT(A1,LEN(A1)-FIND(CHAR(13),A1))

Copy cells B1:C1 down as far as you have data in column A.

Hope this helps / Lars-Åke