Moving data to new table with slightly different headings

rhobert

New Member
Joined
Aug 24, 2011
Messages
7
Hi,

I am in the process of moving data from one platform to another. The source data contains some 8-9k rows with 20 colums. The destination will have the same amount of rows (I expect max 500 to be dropped as they are outdated). However, the fields (colums) in the destination are slightly different, but can be edited with some formulas/transformations. My only question is: how do I easily move the data from the source to the destination without manually having to move the fields, etc. I tried the data model, but I can't seem to get it to work properly.

I tried searching online doesn't really help me, but that could be due to the lack of proper search words - I'm quite proficient in English, but not fluent. In my native language there's too few results on Excel guidance.

Thanks!
Robert
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
This code will copy columns to "sheet2" from the active sheet according to the columns numbers givein in the Mapping array, Try it on simple worksheet and you will see what it does. Change then numbers in mapping to your requirement
Code:
Sub test()
mapping = Array(1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20)
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
inarr = Range(Cells(1, 1), Cells(lastrow, 20))
Worksheets("Sheet2").Select
Range(Cells(1, 1), Cells(lastrow, 20)) = ""
outarr = Range(Cells(1, 1), Cells(lastrow, 20))
For i = 1 To 20
 For j = 1 To lastrow
  outarr(j, mapping(i - 1)) = inarr(j, i)
 Next j
Next i
Range(Cells(1, 1), Cells(lastrow, 20)) = outarr






End Sub
 
Upvote 0
Sorry, took a few more days than I thought it would. Something with time management.
I tried it and see how it works. It does what I need. Only need to add a CONCAT somewhere to merge 2 columns.

Thank you!
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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