Help me write a Macro for Excel PLEASE

Closed
MikeA - May 21, 2009 at 02:49 PM
 alexhett - Jun 5, 2009 at 07:36 AM
Hello, I have an excel data file with a X axis of mass values 50-250 and a Y axis of time from 1-6000 seconds. Filling out the grid are intensity values for a given mass at a particular time. I need to extract every seventh data point because the ones in between are useless to me. Is there a way to extract every 7th data point and put it into a different worksheet using a macro. PLEASE HELP ME!
Related:

2 responses

how to merge rows ,columns thru macro in excel?
2
You don't need a macro for this. One might be helpful, but I think the time & effort you would spend creating/finding etc. the macro would be more than doing it semi-manually.

[note: it's unclear if your "seconds" data is sequential (i.e. 1,2,3,...,6000), or randomly distributed between 1 and 6,000 (i.e. 47, 359, 2, 1000,...etc.). If it is sequential your problem is very easy. But assuming it's not... do the following...

Assuming your data are in two adjacent columns... (if they're not you could transpose/move them)...

Create an index column, 1,2,3,...,etc. Put this adjacent to your data. Make sure you put a header/label above the column of data as "index" or something.

Then, elsewhere (on the same sheet) create a criteria column, 7,14,21,28,...,etc. This column must have the exact same label as the "index" column.

Then use the Data Menu>Filter>Advanced Filter

Select the index column for your List Range, the Criteria column for your criteria, Make sure you include the column headers (i.e. the text that says "index" or whatever) for both columns, then filter the list in place.

This will give filter out the six rows between every seventh row. If your data and you index column are lined up next to each other, your data will receive the same filtering. From there, just select your data columns, and copy them into a new sheet. Then your done! Good Luck!
2