Showing posts with label Excel. Show all posts
Showing posts with label Excel. Show all posts

How to Combine Data from Multiple Rows into One Cell

This article might help:  
http://exceltactics.com/combine-data-multiple-rows-one-cell/ 
Useful formulas:
=IF(A2=A1,C1&", "&B2,B2) 
=IF(A2<>A3,"Last","") 

How to Consolidate Data from Multiple Excel Columns All into One Column?

From:  http://stackoverflow.com/questions/4480227/how-to-consolidate-data-from-multiple-excel-columns-all-into-one-column
Select the data you want to list in one column. Must be contiguous columns. May contain blank cells.
Press Alt+F11 to open the VBE
Press Control+R to view the Project Explorer
Navigate to the project for your workbook and choose Insert - Module
Paste this code in the code pane:
Sub MakeOneColumn()

    Dim vaCells As Variant
    Dim vOutput() As Variant
    Dim i As Long, j As Long
    Dim lRow As Long

    If TypeName(Selection) = "Range" Then
        If Selection.Count > 1 Then
            If Selection.Count <= Selection.Parent.Rows.Count Then
                vaCells = Selection.Value

                ReDim vOutput(1 To UBound(vaCells, 1) * UBound(vaCells, 2), 1 To 1)

                For j = LBound(vaCells, 2) To UBound(vaCells, 2)
                    For i = LBound(vaCells, 1) To UBound(vaCells, 1)
                        If Len(vaCells(i, j)) > 0 Then
                            lRow = lRow + 1
                            vOutput(lRow, 1) = vaCells(i, j)
                        End If
                    Next i
                Next j

                Selection.ClearContents
                Selection.Cells(1).Resize(lRow).Value = vOutput
            End If
        End If
    End If

End Sub

How to combine multiple workbooks to one workbook in Excel?

1. Put all the workbooks that you want to combine into the same directory.
2. Launch an Excel file that you want to combine other workbooks into.
3. Click Developer > Visual Basic, a new Microsoft Visual Basic for applications window will be displayed, clickInsert > Module, and input the following code into the Module:

Sub GetSheets()
Path = "C:\Users\dt\Desktop\dt kte\"
Filename = Dir(Path & "*.xls")
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
For Each Sheet In ActiveWorkbook.Sheets
Sheet.Copy After:=ThisWorkbook.Sheets(1)
Next Sheet
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub
Tip: In the above code, you can change the path to the one that you are using.
4. Then click doc-merge-multiple-workbooks-button button to run the code, and all of the worksheets (including the blank worksheets) within the workbooks have been merged into the master workbook.

From: http://www.extendoffice.com/documents/excel/456-combine-multiple-workbooks.html