+ Reply to Thread
Results 1 to 10 of 10

Finding an Average of every 25 rows.

  1. #1
    Registered User
    Join Date
    11-11-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    5

    Finding an Average of every 25 rows.

    Hi there, ive been given a large data set for a uni project which is too large to be useful at the minute. It consists of about 30,000 rows of element abundances for every 0.2mm of a sediment core. A sample of the file is attatched.

    I would like to find the average of all the elements for every 5mm (so every 25 rows) of the sediment core with out having to go through every row individually finding an average. Ideally the average would be plotted against the medial depth of the values averaged i.e for the first 5mm the average would be plotted against 50.25cm.
    Sorry if ive not given enough info (if not just let me know). Any help would be very much appreciated.
    Attached Files Attached Files
    Last edited by rtb1991; 11-12-2012 at 04:46 PM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Finding an Average of every 25 rows.

    Members aren't usually keen on downloading sheets from external sites, so best attach the sample sheet to your post ( see FAQ for procedure)

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Finding an Average of every 25 rows.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    11-11-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Finding an Average of every 25 rows.

    Ah ok, cheers for letting me know. I tried attaching it but the file is too large.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Finding an Average of every 25 rows.

    Well we only need a small sample of the file, say 100 rows, so delete all the other rows, save it with a different name, and then attach that workbook.

    Hope this helps.

    Pete

  6. #6
    Registered User
    Join Date
    11-11-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Finding an Average of every 25 rows.

    Cool, done that, cheers.

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Finding an Average of every 25 rows.

    Okay, just copy the top row from Sheet2 into Sheet3, so that you have the same headings, and then you can put this formula in C2 of Sheet3:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This will work out the average of column C from rows 2 to 26 inclusive. The formula can be copied across into D2:AD2, and it will work out the average of those 25 rows for the appropriate column. That block of formulae in C2:AD2 can then be copied down as far as you need it, and it will take the average of the next 25 rows successively, i.e, 27 to 51, 52 to 76, 77 to 101 etc.

    I'm not sure what you would want in columns A and B - probably the maximum of each 25 row range. If that is the case, then copy the formula from C2 into A2:B2, and then just change the word AVERAGE to MAX at the start of each formula, and then copy those down.

    I haven't a clue what the values in AE and AF represent, so I'm not sure what to do with those.

    Hope this helps.

    Pete

  8. #8
    Registered User
    Join Date
    11-11-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Finding an Average of every 25 rows.

    Thank you! That works perfectly. I have one other question. The actual spreadsheet (as opposed to the sample) has named sheets (i.e instead of "sheet1/2" ect, they are named "BARD2 Dr A 0.5-1 m" or BARD2 Dr A 1-2 m" ect. How would that be substituted for the "sheet2" in the equation? Would I include the spaces and would i include the exclamation mark?

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Finding an Average of every 25 rows.

    Yes, the exclamation mark separates the sheet name from the cell references, so needs to be there, and you must include the full name of the sheet(even if it has trailing spaces). If there are spaces in the name, then you must also include apostrophes around the name, like this:

    =AVERAGE(INDEX('BARD2 Dr A 0.5-1 m'!C:C,(ROWS($1:1)-1)*25+2):INDEX('BARD2 Dr A 0.5-1 m'!C:C,(ROWS($1:1))*25+1))

    Hope this helps.

    Pete

    P.S. Please mark the thread as Solved if you consider it to be so (the FAQ describes how).

  10. #10
    Registered User
    Join Date
    11-11-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Finding an Average of every 25 rows.

    Thanks for the help Pete, i'll give that a shot and mark it as solved if i get it sorted.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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