View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\)[_681_] Rick Rothstein \(MVP - VB\)[_681_] is offline
external usenet poster
 
Posts: 1
Default compress a potentially long concatenate

You cannot do what you want using worksheet functions, but you can do it
with a User Defined Function. Press Alt+F11 to get into the Visual Basic
editior and then click Insert/Module from its menu bar. When you do this, a
code window will open; copy/paste this code into that window...

Function BigConcatenate(R As Range) As String
Dim C As Range
For Each C In R
BigConcatenate = BigConcatenate & C.Value
Next
End Function

Now, when you go back to your worksheet, you will be able to use
BigConcatenate like a normal worksheet function within your formulas. To use
it, put in a range of cells and whatever is in those cells will be
concatenated together. For the condition you laid out, put this in X3...

=BigConcatenate(AC:IV)

That will automatically concatenate the cells from AC3 to the end (XL2003
and earlier) of your worksheet. This formula can be copied down if needed.

Rick


"robzrob" wrote in message
...
Hello

In X8 I've got IF(LEN(AC8)=1,AC3,""), ie if formula in AC8 gives a
single letter (it will always be a single letter or blank), give AC3,
otherwise nothing. But I want X8 to contain the result for that
concatenated with the same result for AD3, AE3... up to BZ8 and
possibly beyond.