ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to concatenate D1:D64? (https://www.excelbanter.com/excel-discussion-misc-queries/255617-how-concatenate-d1-d64.html)

Joe User[_2_]

How to concatenate D1:D64?
 
What is the most succinct formula to concatenate D1:D64, which contain one
character each?

I thought the following array formula would do the trick:

=concatenate(index(D1:D64,row(1:64)))

It didn't work. Well, I guess I understand why. CONCATENATE({"a","b"})
doesn't work either.

I finally resorted to a macro. But I'm still interested in an Excel
formula.

(Excel 2003 SP3.)


OssieMac

How to concatenate D1:D64?
 
Hi Joe,

I don't think you will find a formula. However, did you create your code as
a User Defined Function (UDF)? Following is an example FYI and anyone else
who is looking for same solution.

Note: A space and underscore at the end of a line is a line break in an
otherwise single line of code.

Function ConCatRng(ByVal rngTarget As Range, _
Optional strSeparator As String)

Application.Volatile

Dim rng As Range

For Each rng In rngTarget
ConCatRng = ConCatRng & rng.Value _
& strSeparator
Next rng

'Remove the trailing separator (if any)
ConCatRng = Left(ConCatRng, _
Len(ConCatRng) - Len(strSeparator))

End Function

Separator is optional. Default is no separator.
Enter function like following for space separators.
=ConCatRng(A1:A25," ")

Enter function like following for no separator.
=ConCatRng(A1:A25)


--
Regards,

OssieMac



מיכאל (מיקי) אבידן

How to concatenate D1:D64?
 
The easiest way will be to install the MOREFUNC add-in.
http://www.download.com/Morefunc/300...-10423159.html
Then you may try [among other helpful functions]:
=MCONCAT(D1:D64,"")
Micky


"Joe User" wrote:

What is the most succinct formula to concatenate D1:D64, which contain one
character each?

I thought the following array formula would do the trick:

=concatenate(index(D1:D64,row(1:64)))

It didn't work. Well, I guess I understand why. CONCATENATE({"a","b"})
doesn't work either.

I finally resorted to a macro. But I'm still interested in an Excel
formula.

(Excel 2003 SP3.)

.



All times are GMT +1. The time now is 11:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com