Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Rob
 
Posts: n/a
Default Concatenate columns with cell data containing Carriage Returns

Hi all,

I want to concatenate text in three columns, which would normally be simple.
However, if we take the cells across the three columns, each contains a set
of data using carriage returns (Alt-Enter).

To put some context on the problem, A is First Name, B is Middle Name, C is
Surname.

The data would look like:
A B C
1 David Robert Hughes
Mark Dave Marriott
Martin Benjamin Murray
2 Shaun Andrew Flannagan
Alison Jane Martin

So I would like to combine the data into some sort of output that will lead
to the following, with each :
1 David Robert Hughes
Mark Dave Marriott
Martin Benjamin Murray
2 Shaun Andrew Flannagan
Alison Jane Martin

It is worth noting that some cells may contain 5 entries using carriage
returns, while others may have 2.

Is anyone able to help?

Many thanks,

Rob
  #2   Report Post  
Harlan Grove
 
Posts: n/a
Default

Rob wrote...
I want to concatenate text in three columns, which would normally be simple.
However, if we take the cells across the three columns, each contains a set
of data using carriage returns (Alt-Enter).

To put some context on the problem, A is First Name, B is Middle Name, C is
Surname.

The data would look like:
A B C
1 David Robert Hughes
Mark Dave Marriott
Martin Benjamin Murray
2 Shaun Andrew Flannagan
Alison Jane Martin

So I would like to combine the data into some sort of output that will lead
to the following, with each :
1 David Robert Hughes
Mark Dave Marriott
Martin Benjamin Murray
2 Shaun Andrew Flannagan
Alison Jane Martin

It is worth noting that some cells may contain 5 entries using carriage
returns, while others may have 2.


This isn't possible without using temporary cells to hold parsed
individual names from each cell. Which leads to the inescapable
conclusion that what you have is a horrible data structure. Is there
any good reason different individuals' names aren't in different rows?

If you need to keep this data structure, then all you really need are
formulas to parse each cell into separate names in different cells. For
example,

F7:
=LEFT(A1,FIND(CHAR(10),A1&CHAR(10))-1)

F8:
=IF(SUMPRODUCT(LEN(F$7:F7)+1)<LEN(A$1),
MID(A$1,SUMPRODUCT(LEN(F$7:F7)+1)+1,FIND(CHAR(10), A$1&CHAR(10),
SUMPRODUCT(LEN(F$7:F7)+1)+1)-SUMPRODUCT(LEN(F$7:F7)+1)-1),"")

Fill F8 down into F9:F11. Then fill F7:F11 right into G7:H11. Then
concatenate as =F7&G7&H7, etc.

If this isn't acceptable, you'd need to use VBA.

  #3   Report Post  
Ashish Mathur
 
Posts: n/a
Default

Hi,

This is an interesting problem to solve. Here is how you can do it.

You will basically have to segregate the data in each cell (entered via Alt
Enter) into various columns. This can be done by using the text to columns
feature (in the the data revenue). Follow the undermentioned procedure

Select delimited in the the text to columns box (Data menu)
In other, enter Alt+010 and finish

This will segregate the data in each cell into various columns.

Regards,


Ashish Mathur

"Rob" wrote:

Hi all,

I want to concatenate text in three columns, which would normally be simple.
However, if we take the cells across the three columns, each contains a set
of data using carriage returns (Alt-Enter).

To put some context on the problem, A is First Name, B is Middle Name, C is
Surname.

The data would look like:
A B C
1 David Robert Hughes
Mark Dave Marriott
Martin Benjamin Murray
2 Shaun Andrew Flannagan
Alison Jane Martin

So I would like to combine the data into some sort of output that will lead
to the following, with each :
1 David Robert Hughes
Mark Dave Marriott
Martin Benjamin Murray
2 Shaun Andrew Flannagan
Alison Jane Martin

It is worth noting that some cells may contain 5 entries using carriage
returns, while others may have 2.

Is anyone able to help?

Many thanks,

Rob

  #4   Report Post  
Rob
 
Posts: n/a
Default

I see! I had hoped to avoid the messy creation of new columns.

Data is provided from a database where it outputs the first name data for
all people in one cell using carriage returns, then middle name data for all
people in the next cell on the row, and similarly with the surname.

Thinking about the output once again, I would actually quite like it in a
similarly messy carriage return type format as the data concatenated from
each row will be feeding through to present on individual Powerpoint
presentation slides.

Ashish, where would be the best starting point with VBA?

Many thanks
Rob

"Ashish Mathur" wrote:

Hi,

This is an interesting problem to solve. Here is how you can do it.

You will basically have to segregate the data in each cell (entered via Alt
Enter) into various columns. This can be done by using the text to columns
feature (in the the data revenue). Follow the undermentioned procedure

Select delimited in the the text to columns box (Data menu)
In other, enter Alt+010 and finish

This will segregate the data in each cell into various columns.

Regards,


Ashish Mathur

"Rob" wrote:

Hi all,

I want to concatenate text in three columns, which would normally be simple.
However, if we take the cells across the three columns, each contains a set
of data using carriage returns (Alt-Enter).

To put some context on the problem, A is First Name, B is Middle Name, C is
Surname.

The data would look like:
A B C
1 David Robert Hughes
Mark Dave Marriott
Martin Benjamin Murray
2 Shaun Andrew Flannagan
Alison Jane Martin

So I would like to combine the data into some sort of output that will lead
to the following, with each :
1 David Robert Hughes
Mark Dave Marriott
Martin Benjamin Murray
2 Shaun Andrew Flannagan
Alison Jane Martin

It is worth noting that some cells may contain 5 entries using carriage
returns, while others may have 2.

Is anyone able to help?

Many thanks,

Rob

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
Data validation, cell protection or other method? KG Excel Discussion (Misc queries) 5 June 17th 05 05:22 AM
Add data to cell w/o loosing initial data jaycain Excel Discussion (Misc queries) 2 March 29th 05 02:23 AM
Hide Cell Content if no data in previous columns Sherry Excel Discussion (Misc queries) 4 February 21st 05 07:27 PM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
Automatic cell increment with data from sheet 1 to sheet 2 Big G Excel Worksheet Functions 2 December 20th 04 05:59 PM


All times are GMT +1. The time now is 10:06 PM.

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"