Copying cells from one column to multiple rows in a different column

%3CLINGO-SUB%20id%3D%22lingo-sub-1755541%22%20slang%3D%22en-US%22%3ECopying%20cells%20from%20one%20column%20to%20multiple%20rows%20in%20a%20different%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1755541%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20large%20data%20set%20where%20I%20need%20to%20take%20several%20rows%20from%20one%20column%20and%20copy%20each%20row%20n%20amount%20of%20times%20to%20a%20different%20column.%20To%20be%20specific%2C%20lets%20say%20in%20column%20A%2C%20I%20have%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1%3C%2FP%3E%3CP%3E2%3C%2FP%3E%3CP%3E3%3C%2FP%3E%3CP%3E4%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20column%20B%2C%20I%20would%20need%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1%3C%2FP%3E%3CP%3E1%3C%2FP%3E%3CP%3E1%3C%2FP%3E%3CP%3E1%3C%2FP%3E%3CP%3E2%3C%2FP%3E%3CP%3E2%3C%2FP%3E%3CP%3E2%3C%2FP%3E%3CP%3E2%3C%2FP%3E%3CP%3E3%3C%2FP%3E%3CP%3E3%3C%2FP%3E%3CP%3E3%3C%2FP%3E%3CP%3E3%3C%2FP%3E%3CP%3Eetc.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20my%20actual%20%22column%20A%22%20data%20set%20has%20thousands%20of%20values%2C%20I%20was%20hoping%20to%20find%20some%20way%20to%20automate%20this%20process%20with%20a%20formula%20or%20macro.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1755541%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1755709%22%20slang%3D%22en-US%22%3ERe%3A%20Copying%20cells%20from%20one%20column%20to%20multiple%20rows%20in%20a%20different%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1755709%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F824002%22%20target%3D%22_blank%22%3E%40jeffheenan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20your%20data%20is%20as%20per%20the%20screenshot%20below%2C%20you%20may%20try%20something%20like%20this...%3C%2FP%3E%3CP%3EIn%20B1%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3DINDEX(A%3AA%2CQUOTIENT(ROWS(A%241%3AA1)-1%2C4)%2B1)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Eand%20then%20copy%20it%20down.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Repeat%20Values.jpg%22%20style%3D%22width%3A%20700px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F224910i074CEABE346F30CA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Repeat%20Values.jpg%22%20alt%3D%22Repeat%20Values.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1755781%22%20slang%3D%22en-US%22%3ERe%3A%20Copying%20cells%20from%20one%20column%20to%20multiple%20rows%20in%20a%20different%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1755781%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F824002%22%20target%3D%22_blank%22%3E%40jeffheenan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20B1%3A%3C%2FP%3E%0A%3CP%3E%3DINDEX(A%3AA%2C(ROW()-1)%2F4%2B1)%3C%2FP%3E%0A%3CP%3EFill%20down.%3C%2FP%3E%0A%3CP%3EAlternatively%2C%20enter%20the%20number%20of%20repetitions%20in%20a%20cell%2C%20for%20example%20C1%2C%20and%20use%3C%2FP%3E%0A%3CP%3E%3DINDEX(A%3AA%2C(ROW()-1)%2F%24C%241%2B1)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1755844%22%20slang%3D%22en-US%22%3ERe%3A%20Copying%20cells%20from%20one%20column%20to%20multiple%20rows%20in%20a%20different%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1755844%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CDIV%20class%3D%22user-login%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%20%3C%2FA%3E%3C%2FDIV%3E%3CDIV%20class%3D%22post-author-login%22%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3EThanks%20guys.%20That%20is%20exactly%20what%20I%20was%20looking%20for.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I have a large data set where I need to take several rows from one column and copy each row n amount of times to a different column. To be specific, lets say in column A, I have:

 

1

2

3

4

 

In column B, I would need:

 

1

1

1

1

2

2

2

2

3

3

3

3

etc.

 

As my actual "column A" data set has thousands of values, I was hoping to find some way to automate this process with a formula or macro.

 

4 Replies

@jeffheenan 

If your data is as per the screenshot below, you may try something like this...

In B1

=INDEX(A:A,QUOTIENT(ROWS(A$1:A1)-1,4)+1)

and then copy it down.

 

Repeat Values.jpg

@jeffheenan 

In B1:

=INDEX(A:A,(ROW()-1)/4+1)

Fill down.

Alternatively, enter the number of repetitions in a cell, for example C1, and use

=INDEX(A:A,(ROW()-1)/$C$1+1)

@Hans Vogelaar 

Thanks guys. That is exactly what I was looking for.

@jeffheenan 

You're welcome! Glad we could help.