Moving data to new table with slightly different headings

rhobert

New Member
Joined
Aug 24, 2011
Messages
4
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
 

Some videos you may like

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

offthelip

Well-known Member
Joined
Dec 23, 2017
Messages
1,636
Office Version
  1. 2010
Platform
  1. Windows
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
 

rhobert

New Member
Joined
Aug 24, 2011
Messages
4
I'll try this tomorrow. Thank you. I'll get back here to confirm it works!
 

rhobert

New Member
Joined
Aug 24, 2011
Messages
4
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!
 

Watch MrExcel Video

Forum statistics

Threads
1,122,168
Messages
5,594,632
Members
413,919
Latest member
ZaxAlchemist

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
Top