+ Reply to Thread
Results 1 to 4 of 4

How to combine content of multiple cells into one cell

Hybrid View

  1. #1
    Registered User
    Join Date
    06-26-2008
    Location
    Asia
    Posts
    53

    How to combine content of multiple cells into one cell

    Hi.

    I am trying to use mail merge to send out notification to employees on the details their expense claims had been processed for payment.

    My database (pivottable) has a column that lists down all the expense claims document numbers and the total to be paid for all these expense claims added together. How do I create a formula to concatenate all the document numbers into one cell, given that the number of cells containing the document numbers vary from employee to employee? I have attached the file showing the format of my database (pivottable).

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to combine content of multiple cells into one cell

    Care to post an example of the results you're looking for?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-26-2008
    Location
    Asia
    Posts
    53

    Re: How to combine content of multiple cells into one cell

    Hi.

    I've added the results that I'm looking for in red bold of the attached file.

    Any clue?

    Thanks!
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to combine content of multiple cells into one cell

    Run this macro with the pivot report sheet active:
    Option Explicit
    
    Sub DocReport()
    'JBeaucaire (7/10/2009)
    Dim FR As Long, LR As Long, NR As Long, i As Long, MyVal As String
    FR = Cells.Find("Vendor ID").Row + 1
    LR = Range("A" & Rows.Count).End(xlUp).Row - 1
    NR = LR + 3
    
    Range("A" & NR) = "Vendor ID"
    Range("B" & NR) = "Document(s)"
    
        For i = FR To LR
            If Cells(i, "A") Like "*Total" Then
                'Do nothing
            ElseIf IsEmpty(Cells(i, "A")) Then
                Cells(NR, "B") = Cells(NR, "B") & ";" & Cells(i, "D")
            ElseIf Cells(i, "A") Like "EE*" Then
                NR = NR + 1
                Cells(NR, "A") = Cells(i, "A")
                Cells(NR, "B") = Cells(i, "D")
            End If
        Next i
    
        With Range("A" & LR + 4).CurrentRegion
            .Font.Bold = True
            .Font.ColorIndex = 3
            .Select
        End With
    End Sub

+ 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