Copy a cell every x rows
Solved
bix
-
Theo.R Posted messages 585 Status Member -
Theo.R Posted messages 585 Status Member -
Hello, I have an Excel sheet with a column of 5200 grouped data (meaning the first is in cell A1 and the last in cell A5200). I would like to copy this data to another sheet, but I want one data point every 253 rows. How can I do this without copying each data point one by one? Is there, for example, a "paste every 253 rows" option?
Thank you in advance
SB
Thank you in advance
SB
1 answer
Hello,
In an adjacent column, you can calculate the rows for which you need to copy the value, then filter on that and copy all the relevant rows.
The following formula to be entered in B1 and then dragged down will display "ok" for rows 1, 254, 507, 760, ... (every 253 rows starting from row 1):
=IF(MOD(ROW(A1)-1,9)=0,"ok","")
In an adjacent column, you can calculate the rows for which you need to copy the value, then filter on that and copy all the relevant rows.
The following formula to be entered in B1 and then dragged down will display "ok" for rows 1, 254, 507, 760, ... (every 253 rows starting from row 1):
=IF(MOD(ROW(A1)-1,9)=0,"ok","")
Thank you for your response, but your formula will only allow me to see "ok" marked in each cell where I need to enter a value. However, I will then have to manually do the "copy-paste" every time "ok" is displayed. In my case, that's 5199 times (I’m not counting cell A1). It’s precisely this step that I’m trying to avoid.
-> You just have a copy-paste to do to get all the lines.
Thank you very much for your help :)
See you soon
Then, while keeping your click in the pasted text (vba code), you run the macro (green arrow in the action bar: "Run Sub F5"
Wait for it to process all the lines and there you go :-), be careful! no CtrlZ is possible, so make it on a copy just in case ;)