Transfer multi-column data to 2 column

ExcelNewbie2020

Active Member
Joined
Dec 3, 2020
Messages
293
Office Version
  1. 365
Platform
  1. Windows
Sirs,

I have multi-column data which was arranged horizontally and vertically. If it is possible, the multi-column can be transferred to 2 columns to be arranged vertically.

For better understanding of my issue. please find the attached sample file.. Thank you in advance.

sample.xlsx
ABCDEFGHIJKLMNOPQRSTUV
1RESULT
2INPUT DATADateAmount
3NameDateAmountDateAmountDateAmountDateAmountDateAmountDateAmountDateAmountDateAmount05-07-192,000.00FORMULA HERE
4Name 105-07-192,000.0010-23-193,000.0004-05-192,000.0005-08-196,000.0007-08-199,500.0007-30-1910,000.0007-07-192,500.00
5Name 207-07-192,500.0006-22-192,500.0011-21-192,500.0008-15-199,500.0003-31-192,000.00
6Name 303-31-192,000.0012-11-192,000.0001-06-196,000.0007-21-192,500.0010-10-192,500.00
7Name 412-24-192,000.0012-19-192,500.0008-26-192,500.0007-12-192,500.00
8Name 506-17-192,500.0006-01-192,000.0010-11-192,500.0008-23-192,500.0011-13-1910,000.0012-26-192,500.00
9Name 612-15-195,000.0009-30-193,000.0009-28-196,000.0002-25-192,500.0001-19-1910,000.0008-15-1910,000.00
10Name 705-16-195,000.0004-01-192,500.0011-17-1910,000.0005-19-196,000.00
11Name 804-06-193,000.0003-14-196,000.0010-30-192,500.0007-05-196,000.0005-01-1910,000.00
12
13
14
15*ALL DATA IN BLUE COLOR CELLS (INPUT DATA) WILL AUTOMATICALLY TRANSFER TO RESULT COLUMN
16* MUST BE GROUP BY DATE & AMOUNT
17
18
19
20
21
Sheet2
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Here is a macro for you to consider:

VBA Code:
Sub Transfer_Multi_Column()
  Dim dic As Object, i As Long, j As Long
  Set dic = CreateObject("Scripting.Dictionary")
  For i = 4 To Range("A" & Rows.Count).End(3).Row   'initial row 4
    For j = 2 To Columns("Q").Column Step 2         'initial column 2
      If Cells(i, j).Value <> "" Then dic(Cells(i, j).Value) = dic(Cells(i, j).Value) + Cells(i, j + 1).Value
    Next
  Next
  Range("T3").Resize(dic.Count, 2).Value = Application.Transpose(Array(dic.keys, dic.items))
End Sub
 
Upvote 0
Here is a macro for you to consider:

VBA Code:
Sub Transfer_Multi_Column()
  Dim dic As Object, i As Long, j As Long
  Set dic = CreateObject("Scripting.Dictionary")
  For i = 4 To Range("A" & Rows.Count).End(3).Row   'initial row 4
    For j = 2 To Columns("Q").Column Step 2         'initial column 2
      If Cells(i, j).Value <> "" Then dic(Cells(i, j).Value) = dic(Cells(i, j).Value) + Cells(i, j + 1).Value
    Next
  Next
  Range("T3").Resize(dic.Count, 2).Value = Application.Transpose(Array(dic.keys, dic.items))
End Sub
thanks man, it works.. I also add a code that every time a cell range was changed the macro will automatically run..
 
Upvote 0
If your data is not too big and you were interested in a formula approach you can do it with just these two formulas in T3:U3 and the other results will automatically spill down the other required rows. I have included a sort to put the dates in chronological order.

ExcelNewbie2020.xlsm
BCDEFGHIJKLMNOPQRSTU
1
2INPUT DATADateAmount
3DateAmountDateAmountDateAmountDateAmountDateAmountDateAmountDateAmountDateAmount6/01/20196000
47/05/2019200023/10/201930005/04/201920008/05/201960008/07/2019950030/07/20191000019/01/201910000
57/07/2019250022/06/2019250021/11/2019250015/08/2019950025/02/20192500
631/03/2019200011/12/201920006/01/2019600021/07/2019250010/10/2019250014/03/20196000
724/12/2019200019/12/2019250026/08/2019250012/07/2019250031/03/20192000
817/06/201925001/06/2019200011/10/2019250023/08/2019250013/11/20191000026/12/201925001/04/20192500
915/12/2019500030/09/2019300028/09/2019600025/02/2019250019/01/20191000015/08/2019100005/04/20192000
1016/05/201950001/04/2019250017/11/20191000019/05/201960006/04/20193000
116/04/2019300014/03/2019600030/10/201925005/07/201960001/05/2019100001/05/201910000
127/05/20192000
138/05/20196000
1416/05/20195000
1519/05/20196000
161/06/20192000
1717/06/20192500
1822/06/20192500
195/07/20196000
207/07/20192500
218/07/20199500
2212/07/20192500
2321/07/20192500
2430/07/201910000
2515/08/201919500
2623/08/20192500
2726/08/20192500
2828/09/20196000
2930/09/20193000
3010/10/20192500
3111/10/20192500
3223/10/20193000
3330/10/20192500
3413/11/201910000
3517/11/201910000
3621/11/20192500
3711/12/20192000
3815/12/20195000
3919/12/20192500
4024/12/20192000
4126/12/20192500
42
Date Summary
Cell Formulas
RangeFormula
T3:T41T3=LET(f,FILTERXML("<p><c>"&TEXTJOIN("</c><c>",1,IF(B3:Q3="Date",B4:Q11,""))&"</c></p>","//c"),SORT(UNIQUE(FILTER(f,f>0))))
U3:U41U3=SUMIFS(C4:Q11,B4:P11,T3#)
Dynamic array formulas.
 
Upvote 0
Solution
If your data is not too big and you were interested in a formula approach you can do it with just these two formulas in T3:U3 and the other results will automatically spill down the other required rows. I have included a sort to put the dates in chronological order.

ExcelNewbie2020.xlsm
BCDEFGHIJKLMNOPQRSTU
1
2INPUT DATADateAmount
3DateAmountDateAmountDateAmountDateAmountDateAmountDateAmountDateAmountDateAmount6/01/20196000
47/05/2019200023/10/201930005/04/201920008/05/201960008/07/2019950030/07/20191000019/01/201910000
57/07/2019250022/06/2019250021/11/2019250015/08/2019950025/02/20192500
631/03/2019200011/12/201920006/01/2019600021/07/2019250010/10/2019250014/03/20196000
724/12/2019200019/12/2019250026/08/2019250012/07/2019250031/03/20192000
817/06/201925001/06/2019200011/10/2019250023/08/2019250013/11/20191000026/12/201925001/04/20192500
915/12/2019500030/09/2019300028/09/2019600025/02/2019250019/01/20191000015/08/2019100005/04/20192000
1016/05/201950001/04/2019250017/11/20191000019/05/201960006/04/20193000
116/04/2019300014/03/2019600030/10/201925005/07/201960001/05/2019100001/05/201910000
127/05/20192000
138/05/20196000
1416/05/20195000
1519/05/20196000
161/06/20192000
1717/06/20192500
1822/06/20192500
195/07/20196000
207/07/20192500
218/07/20199500
2212/07/20192500
2321/07/20192500
2430/07/201910000
2515/08/201919500
2623/08/20192500
2726/08/20192500
2828/09/20196000
2930/09/20193000
3010/10/20192500
3111/10/20192500
3223/10/20193000
3330/10/20192500
3413/11/201910000
3517/11/201910000
3621/11/20192500
3711/12/20192000
3815/12/20195000
3919/12/20192500
4024/12/20192000
4126/12/20192500
42
Date Summary
Cell Formulas
RangeFormula
T3:T41T3=LET(f,FILTERXML("<p><c>"&TEXTJOIN("</c><c>",1,IF(B3:Q3="Date",B4:Q11,""))&"</c></p>","//c"),SORT(UNIQUE(FILTER(f,f>0))))
U3:U41U3=SUMIFS(C4:Q11,B4:P11,T3#)
Dynamic array formulas.
interesting formula.. it works like a charm...a simple approach.. thank you very much
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,904
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top