+ Reply to Thread
Results 1 to 4 of 4

concatenate

Hybrid View

Kandi25 concatenate 11-28-2011, 07:16 AM
Domski Re: concatenate 11-28-2011, 07:26 AM
Kandi25 Re: concatenate 11-28-2011, 09:46 AM
Kandi25 Re: concatenate 11-28-2011, 10:09 AM
  1. #1
    Registered User
    Join Date
    11-28-2011
    Location
    Debrecen, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    4

    Cool concatenate

    --------------------------------------------------------------------------------

    Dear All,

    I have to put words / expressions from several cells (each word / expression is in one cell) into one cell, next to each other, and to separate them with sign '+'.

    I've tried to do it with function 'concatenate', but it allows max. 30 units in a string, and if I put a sign among each word then it reduces to 15.
    And in some cases I should do a string with about 50 words.

    Do you have any ideas?
    If you need other info to see clearer, ask!!!

    Thank you in advance,
    Kandi25

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: concatenate

    A UDF like this would do the trick:

    Public Function ConcatAll(rngConcat As Range, Optional strSpacer As String) As String
    
        Dim rngLoopRange As Range
    
        For Each rngLoopRange In rngConcat
            If ConcatAll = "" Then
                ConcatAll = rngLoopRange
            Else
                ConcatAll = ConcatAll & strSpacer & rngLoopRange
            End If
        Next rngLoopRange
    
    End Function

    Use it like this: =CONCATALL(A1:M1,"+")

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    11-28-2011
    Location
    Debrecen, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: concatenate

    Oh, you are great!!! ))
    It works!
    Thanks a lot!
    Now I am just trying to do that the column was in the same excel worksheet, to which I referred in the function concatall(A1:A220,"+"), and I don't need this column anymore. But of course as soon as I delete it, also my created cell - where all the items are with '+' - disppears.....
    But I think i can do it.

    I am really grateful to your quick and clever help!!!

    have a nice day!
    Kandi25

  4. #4
    Registered User
    Join Date
    11-28-2011
    Location
    Debrecen, Hungary
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: concatenate

    Oh great!!! I could do the reference from another document, so that is great now!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1