Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Merging cells with no-adjacent data

I want to be able to combine the contents of a range of cells into one cell.

Using the concatenate command includes spacing and/or characters for blank
cells.
ex: , , , , John Smith, , Joe Frazier, , etc.

Using the substitute trim commands puts excess characters inside cell values
ex: John, Smith, Joe, Franzier etc.

I want to be able to take the contents of non-blank cells in a row (15
columns) and combine them with a space and comma between the non blank cell
values.

Please help!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,339
Default Merging cells with no-adjacent data

try this function:

in cell put

=merge(A1:H1)



Function merge(inrng As Range) As String
For Each cell In inrng
If Application.And(Len(cell) 0, cell < " ") Then
merge = merge & cell.Value & ", "
End If
Next
merge = Left(merge, Len(merge) - 2)
End Function

"crazymfr" wrote:

I want to be able to combine the contents of a range of cells into one cell.

Using the concatenate command includes spacing and/or characters for blank
cells.
ex: , , , , John Smith, , Joe Frazier, , etc.

Using the substitute trim commands puts excess characters inside cell values
ex: John, Smith, Joe, Franzier etc.

I want to be able to take the contents of non-blank cells in a row (15
columns) and combine them with a space and comma between the non blank cell
values.

Please help!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Merging cells with no-adjacent data

how do I get VBA to interact with Excel?

I dont have a lot of experience in VBA.

"Toppers" wrote:

try this function:

in cell put

=merge(A1:H1)



Function merge(inrng As Range) As String
For Each cell In inrng
If Application.And(Len(cell) 0, cell < " ") Then
merge = merge & cell.Value & ", "
End If
Next
merge = Left(merge, Len(merge) - 2)
End Function

"crazymfr" wrote:

I want to be able to combine the contents of a range of cells into one cell.

Using the concatenate command includes spacing and/or characters for blank
cells.
ex: , , , , John Smith, , Joe Frazier, , etc.

Using the substitute trim commands puts excess characters inside cell values
ex: John, Smith, Joe, Franzier etc.

I want to be able to take the contents of non-blank cells in a row (15
columns) and combine them with a space and comma between the non blank cell
values.

Please help!

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,339
Default Merging cells with no-adjacent data

Alt+F11

then Alt+I

Select Module from Menu

You will get a blank area (labelled "General")

Copy/paste code into module

HTH

"crazymfr" wrote:

how do I get VBA to interact with Excel?

I dont have a lot of experience in VBA.

"Toppers" wrote:

try this function:

in cell put

=merge(A1:H1)



Function merge(inrng As Range) As String
For Each cell In inrng
If Application.And(Len(cell) 0, cell < " ") Then
merge = merge & cell.Value & ", "
End If
Next
merge = Left(merge, Len(merge) - 2)
End Function

"crazymfr" wrote:

I want to be able to combine the contents of a range of cells into one cell.

Using the concatenate command includes spacing and/or characters for blank
cells.
ex: , , , , John Smith, , Joe Frazier, , etc.

Using the substitute trim commands puts excess characters inside cell values
ex: John, Smith, Joe, Franzier etc.

I want to be able to take the contents of non-blank cells in a row (15
columns) and combine them with a space and comma between the non blank cell
values.

Please help!

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
Merging adjacent repeated columns with a macro [email protected] Excel Discussion (Misc queries) 2 April 3rd 07 07:44 PM
Finding repeated data in adjacent cells akeene Excel Discussion (Misc queries) 3 July 14th 06 08:54 PM
charting non-adjacent data cells BK Charts and Charting in Excel 3 January 21st 06 08:41 PM
Is there an easy way to count when adjacent cells contain same data? mrarcade Excel Worksheet Functions 1 August 3rd 05 10:36 AM
Entering data and spanning adjacent cells QuartetmanIA Excel Discussion (Misc queries) 8 July 11th 05 04:44 PM


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