move data from one column to multiple columns

mark91345

Board Regular
Joined
Feb 11, 2011
Messages
113
I am trying to copy sections of one column to multiple columns.
For example, how can I copy the PROFIT data (for AAEQX) from Column K into Column P, but then copy ACWIX into Column Q, and so on (I have 226 of these to do)?

In the example, for the first couple columns, I simply used '=' and the cell address; but I need to automate this, somehow, as I have too much data to do this to (plus, I know I'll confuse myself).

Excel 2010
JKLMNOPQ
1Mutual FundDistance milesProfitDistance milesAAEQXACWIXADENX
2AAEQX(blank)0.0(blank)0.00.0
30-9921.30-9921.313.7
4100-1990.0100-1990.00.0
5200-29937.3200-29937.344.5
6300-39919.5300-39919.517.0
7400-49918.2400-49918.244.5
8500-59928.4500-59928.453.9
9600-69934.4600-69934.498.5
10700-79930.0700-79930.071.7
11800-89934.2800-89934.265.6
12900-99930.5900-99930.531.2
131000-109922.71000-109922.733.8
141100-119942.31100-119942.364.9
151200-129922.21200-129922.20.0
161300-139935.11300-139935.10.0
171400-149943.01400-149943.00.0
181500-15990.01500-15990.00.0
191600-16990.01600-16990.0111.3
201700-17990.01700-17990.049.5
211800-18990.01800-18990.00.0
221900-19990.01900-19990.00.0
232000-20990.02000-20990.00.0
242100-21990.02100-21990.00.0
252200-22990.02200-22990.00.0
262300-23990.02300-23990.00.0
272400-24990.02400-24990.00.0
282500-25990.02500-25990.00.0
29>26000.0>26000.00.0
30ACWIX(blank)0.0
310-9913.7
32100-1990.0
33200-29944.5
34300-39917.0
35400-49944.5
36500-59953.9
37600-69998.5
38700-79971.7
39800-89965.6
40900-99931.2
411000-109933.8
421100-119964.9
431200-12990.0

<tbody>
</tbody>
Sheet4
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
profit data appears to be in L

do you mean you want to insert a new column and put the value into it

this will push all columns one to the right
 
Upvote 0
Well, I already have the column headers listed (see Column O,P, and there are 220 more).
From the original Profit column, I am trying to copy data from it to the columns on the right, but only for a specific portion (for each Mutual fund--- note: I only show a couple because of the sheer length). I did a couple examples to see the what the finished product should look like (Col O & P)


profit data appears to be in L

do you mean you want to insert a new column and put the value into it

this will push all columns one to the right
 
Upvote 0
Well, I already have the column headers listed (see Column O,P, and there are 220 more).
You already have 222 column headers in cells O1:IB1? If so, then please answer all of these questions...

1) Will you always have the same 222 Mutual Fund names in Column J?

2.A) If so, will they always be in the same order as the headers?

2.B) If not, would it be alright not to have the header in O1:IB1 and let the code put in the headers for the data you actually have in the order the data is presented in?
 
Upvote 0
1) Yes, I will always have the same 222 Mutual Fund (Col J)
2) Always in the same order (alphabetical)
2b) I would be THRILLED to have the headers (the mutual funds like AAEQX, etc.) be put in by the code.

You already have 222 column headers in cells O1:IB1? If so, then please answer all of these questions...

1) Will you always have the same 222 Mutual Fund names in Column J?

2.A) If so, will they always be in the same order as the headers?

2.B) If not, would it be alright not to have the header in O1:IB1 and let the code put in the headers for the data you actually have in the order the data is presented in?
 
Upvote 0
1) Yes, I will always have the same 222 Mutual Fund (Col J)
2) Always in the same order (alphabetical)
2b) I would be THRILLED to have the headers (the mutual funds like AAEQX, etc.) be put in by the code.
Okay, assuming Column N exists and all column to the right of Column N are blank, give this macro a try...
Code:
Sub RearrangeMutualFundData()
  Dim Ar As Range, LastRow As Long, Blanks As Range
  LastRow = Cells(Rows.Count, "K").End(xlUp).Row
  Set Blanks = Range("J1:J" & LastRow).SpecialCells(xlBlanks)
  For Each Ar In Blanks.Areas
    With Cells(1, Columns.Count).End(xlToLeft).Offset(, 1)
      .Value = Ar(1).Offset(-1)
      Ar.Offset(, 2).Copy .Offset(1)
    End With
  Next
End Sub
 
Upvote 0
Thank you, Rick. This really made it easy for me. I tried reading the script to understand, but I see that I am going to have to learn this. Just to be sure, this is called "Visual Basic", correct?
 
Upvote 0
Thank you, Rick. This really made it easy for me. I tried reading the script to understand, but I see that I am going to have to learn this. Just to be sure, this is called "Visual Basic", correct?
Actually, Visual Basic for Applications (VBA for short). If you are thinking of buying books or training, make sure the "for Application" or "A" is in there... Microsoft has a product they call VB or Visual Basic which is not the same thing at all.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,864
Members
449,052
Latest member
Fuddy_Duddy

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