#1   Report Post  
JT
 
Posts: n/a
Default Concatenate

When using concatenate if I have cells that are empty in
that row how can I disregard including the empty cell,
without typing function in manually for each row ?

Example:
Col 1 Col 2 Col 3 Col 4 Col 5
Dan Dave Paul Sue

Function I use is
=CONCATENATE(A1,",",B1,",",C1,",",E1,",",)
Results I receive a Dan,,Dave,Paul, Sue
Like to see: Dan, Dave, Paul, Sue
  #2   Report Post  
Max
 
Posts: n/a
Default

Try in say, F1:

=SUBSTITUTE(TRIM(A1&" "&B1&" "&C1&" "&D1&" "&E1)," ",", ")

Copy F1 down

The above essentially uses TRIM to remove any extraneous "in-between" spaces
from the concat string first, then SUBSTITUTE will replace all the single
spaces: " " in between words with a comma-space: ", " to give the desired
result

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"JT" wrote in message
...
When using concatenate if I have cells that are empty in
that row how can I disregard including the empty cell,
without typing function in manually for each row ?

Example:
Col 1 Col 2 Col 3 Col 4 Col 5
Dan Dave Paul Sue

Function I use is
=CONCATENATE(A1,",",B1,",",C1,",",E1,",",)
Results I receive a Dan,,Dave,Paul, Sue
Like to see: Dan, Dave, Paul, Sue



  #3   Report Post  
Biff
 
Posts: n/a
Default

Hi!

Try this:

=SUBSTITUTE(CONCATENATE
(A1,",",B1,",",C1,",",D1,",",E1),",,",",")

Biff

-----Original Message-----
When using concatenate if I have cells that are empty in
that row how can I disregard including the empty cell,
without typing function in manually for each row ?

Example:
Col 1 Col 2 Col 3 Col 4 Col 5
Dan Dave Paul Sue

Function I use is
=CONCATENATE(A1,",",B1,",",C1,",",E1,",",)
Results I receive a Dan,,Dave,Paul, Sue
Like to see: Dan, Dave, Paul, Sue
.

  #4   Report Post  
Biff
 
Posts: n/a
Default

Hi!

Upon further testing I discovered that my formula only
works under certain conditions.

Use Max's formula, it's more robust.

Biff

-----Original Message-----
Hi!

Try this:

=SUBSTITUTE(CONCATENATE
(A1,",",B1,",",C1,",",D1,",",E1),",,",",")

Biff

-----Original Message-----
When using concatenate if I have cells that are empty in
that row how can I disregard including the empty cell,
without typing function in manually for each row ?

Example:
Col 1 Col 2 Col 3 Col 4 Col 5
Dan Dave Paul Sue

Function I use is
=CONCATENATE(A1,",",B1,",",C1,",",E1,",",)
Results I receive a Dan,,Dave,Paul, Sue
Like to see: Dan, Dave, Paul, Sue
.

.

  #5   Report Post  
Gord Dibben
 
Posts: n/a
Default

JT

In addition to Max's solution you could use a User Defined Function that
ignores blank cells.

Function ConCatRange(CellBlock As Range) As String
Dim Cell As Range
Dim sbuf As String
For Each Cell In CellBlock
If Len(Cell.text) 0 Then sbuf = sbuf & Cell.text & ","
Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

usage is =ConCatRange(A1:E1) which will ignore D1


Gord Dibben Excel MVP

On Fri, 25 Feb 2005 19:27:02 -0800, "JT" wrote:

When using concatenate if I have cells that are empty in
that row how can I disregard including the empty cell,
without typing function in manually for each row ?

Example:
Col 1 Col 2 Col 3 Col 4 Col 5
Dan Dave Paul Sue

Function I use is
=CONCATENATE(A1,",",B1,",",C1,",",E1,",",)
Results I receive a Dan,,Dave,Paul, Sue
Like to see: Dan, Dave, Paul, Sue


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 do I concatenate information in Excel and keep the number form DaveAg02 Excel Worksheet Functions 7 May 9th 08 07:44 PM
COPY A CONCATENATE CELL TO BLANK CELL PUTTING IN THE NEXT BLANK C. QUEST41067 Excel Discussion (Misc queries) 1 January 15th 05 09:29 PM
UDF to evaluate result of concatenate() with additional arg. [email protected] Excel Discussion (Misc queries) 2 January 13th 05 01:47 PM
Concatenate cells without specifying/writing cell address individually Hari Excel Discussion (Misc queries) 4 January 3rd 05 06:05 PM
Concatenate two halves of a phone number Harry Macdivitt Excel Worksheet Functions 1 November 19th 04 04:11 PM


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