+ Reply to Thread
Results 1 to 5 of 5

Macro for SUM and AVE of data in every 6th row

  1. #1
    Registered User
    Join Date
    11-29-2011
    Location
    Ecuador
    MS-Off Ver
    Excel 2007
    Posts
    2

    Macro for SUM and AVE of data in every 6th row

    Hello Forum:

    I have a extensive table of weather data that has been collected every 10 minutes. In other words, each row has a data point of precipitation, wind speed and wind gust speed for every 10 minute interval. I would like to find the total precipitation for each hour (column E), and the mean wind speed (column F) and gust speed (column G) for that hour. Seems like its would be a simple matter of selecting every 6th row, and calculating the sum or average for the appropriate column for that row and the preceding five row, then looping through to repeat for the data six rows below, etc. etc. If useful, I have separate columns for the reading number (sequential, 1 - 4303; column A), date 144 rows for each date; column B), time (in HH:MM format, 24-hour clock; column C), and the unique numeric date/time value (e.g. 40844.3333 = 10/28/2011 at 08:00; column D).

    Hopefully, this explanation makes sense.

    Thanks for any help anyone can offer ...

    La French

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Macro for SUM and AVE of data in every 6th row

    Hi

    Can you please add an example file, with sufficient data to get a good appreciation of your situation, and expected output from sample data.

    rylo

  3. #3
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Macro for SUM and AVE of data in every 6th row

    Try This,


    Please Login or Register  to view this content.
    The other format stuff , if you can do what rylo suggested it would great
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  4. #4
    Registered User
    Join Date
    11-29-2011
    Location
    Ecuador
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Macro for SUM and AVE of data in every 6th row

    Thanks for the answers thus far ...

    I have attached a bit of the raw data file. The no-fill columns (A-H) are the actual raw data, while the blue columns (I-K) are the results of manual sum / ave calculations for each hourly period - the results I'd like to automate.

    JapanDave ... when I try and run the macro you wrote, I receive a "Subscript Out of Range" error in VBE.

    Thanks again ...
    Attached Files Attached Files

  5. #5
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Macro for SUM and AVE of data in every 6th row

    You need to assign the sheet name to the code. But it looks like you need a row added anyway.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1