+ Reply to Thread
Results 1 to 10 of 10

taking average

  1. #1
    Registered User
    Join Date
    07-22-2015
    Location
    Nairobi
    MS-Off Ver
    2007
    Posts
    19

    taking average

    Dear friends
    I need help here; I have daily data on trading volume- which i hope to develop some measure. the first step is to take a monthly average and spread it through every trading day. for example take stock A-i would wish to obtain the average volume for month 1 and the spread that average on every day. the real issue is that the sheet has about 60000 lines and so doing a manual work would take alot of effort and time. kindly help me with how i can program this task.
    Date volume Monthly_average
    6-Jan-09 697 28762.36842
    7-Jan-09 1835 28762.36842
    8-Jan-09 500 28762.36842
    9-Jan-09 114300 28762.36842
    12-Jan-09 800 28762.36842
    13-Jan-09 14100 28762.36842
    14-Jan-09 3100 28762.36842
    15-Jan-09 132034 28762.36842
    16-Jan-09 33000 28762.36842
    19-Jan-09 34000 28762.36842
    20-Jan-09 49900 28762.36842
    21-Jan-09 3500 28762.36842
    22-Jan-09 3275 28762.36842
    23-Jan-09 21513 28762.36842
    26-Jan-09 112300 28762.36842
    27-Jan-09 16431 28762.36842
    28-Jan-09 2700 28762.36842
    29-Jan-09 2000 28762.36842
    30-Jan-09 500 28762.36842

  2. #2
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: taking average

    Hi rochenge,

    It seems to be unclear for what you are trying to achieve.

    It would be good if you could attach a sample workbook here and explain in more detail.
    You can attach a sample workbook by clicking on "Go Advanced" button at the bottom of the post and then clicking on the "Paper Clip" icon from the tools above.
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  3. #3
    Registered User
    Join Date
    07-22-2015
    Location
    Nairobi
    MS-Off Ver
    2007
    Posts
    19

    Re: taking average

    Dear friends
    I need help here; I have daily data on trading volume- which i hope to develop some measure.
    the first step is to take a monthly average and spread it through every trading day.
    for example take stock A; I would wish to obtain the average volume for month 1 and the spread that average on every day.
    the real issue is that the sheet has about 60000 lines and so doing a manual work would take a lot of effort and time.
    kindly help me with how i can program this task.I have attached a sample workbook indicating the kind of output am looking for;
    specifically i need to fill column C and the lines are too many
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    04-27-2015
    Location
    Abu Dhabi, U.A.E
    MS-Off Ver
    Office 365 | 2016
    Posts
    697

    Re: taking average

    Refer the attached sheet.
    Attached Files Attached Files

  5. #5
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: taking average

    Hi,
    You can go for AVERAGEIFS formula which calculates the average on the basis of various criteria specified.

    Here is the formula-

    Please Login or Register  to view this content.
    Using the formula-

    1. Paste the formula above in cell C2.
    2. Copy the formula down till the end of your range.

    Understanding the formula-


    =AVERAGEIFS(B:B,A:A,">"&EOMONTH(A2,-1),A:A,"<"&EOMONTH(A2,0))

    B:B >> Range for which the average should be calculated.

    A:A >> Range for the first criteria

    ">"&EOMONTH(A2,-1) >> This is the First criteria. EOMONTH(A2,-1) returns the last date of the month before the date in cell A2, and the greater than symbol checks if the data in Criteria Range 1 is greater than EOMONTH(A2,-1)

    A:A >> Range for the second criteria.

    "<"&EOMONTH(A2,0) >>This is the second criteria. EOMONTH(A2,0) returns the last date of the month for the date in cell A2, and the smaller than symbol checks if the data in Criteria Range 1 is smaller than EOMONTH(A2,0).

    Finally the formula calculates the average for all the values for which both conditions are fulfilled.
    Last edited by sourabhg98; 02-14-2016 at 04:45 AM.

  6. #6
    Registered User
    Join Date
    07-22-2015
    Location
    Nairobi
    MS-Off Ver
    2007
    Posts
    19

    Re: taking average

    Dear Sourabhg98,
    I like your approach, one problem though is that the average computed is not correct,
    what could be missing in the criteria or did i get the formula correct?
    here is the outcome of the formula you posted.
    for example for the first month the correct average should be 28762.36842 while the formula gives me 205834.8
    Attached Files Attached Files

  7. #7
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: taking average

    Are you sure?
    In the file you attached it shows me 28762.37 in Cell C2 which is the correct average as you said.

    However, I just missed one equal to sign,
    Please Login or Register  to view this content.
    But the previous formula is also returning the same result as you said.
    Please check again.

    excelforum-1.jpg
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-22-2015
    Location
    Nairobi
    MS-Off Ver
    2007
    Posts
    19

    Re: taking average

    what is puzzling Sourabhg98, is that- as i said earlier, the rows of the real data are more
    than the sample i posted- since the forum refuses large attachement, so the formula works for
    the sample but each time i add more rows or i copy the formula to the real extended data i get incorrect averages
    although the pattern of breaking after each month works perfectly.
    Rogers

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: taking average

    Quote Originally Posted by Shareez Saleem View Post
    Refer the attached sheet.
    https://www.excelforum.com/showthread.php?t=1040120 ----------
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  10. #10
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: taking average

    Make a table of your data. (insert => table)

    add d2 = month(a2)

    After that a pivot table, with the average of the data.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to calculate the average without taking zeros values?
    By wiliam_s in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-14-2015, 05:24 AM
  2. Excell - Getting the average without taking into account zero and DIV/0
    By danfreiburg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-29-2015, 10:51 AM
  3. Taking average in 7 cells in a column
    By shawpnik in forum Excel General
    Replies: 3
    Last Post: 11-05-2014, 12:03 AM
  4. Taking a average value(month sensitive) from a separate sheet
    By M1kef in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-04-2013, 07:45 AM
  5. Taking Average for Multiple Columns of Varying Length
    By NALynch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2012, 04:12 PM
  6. [SOLVED] Taking average instead of SUMPRODUCT
    By john_london in forum Excel General
    Replies: 5
    Last Post: 07-30-2012, 01:04 PM
  7. Taking Average of rows given criteria
    By undergraduate in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2010, 11:52 PM

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