+ Reply to Thread
Results 1 to 6 of 6

Count average per month

  1. #1
    Registered User
    Join Date
    02-07-2008
    Posts
    60

    Count average per month

    Hello all

    I would like to kindly ask you for favor.

    I am getting a report every month with data covering last three months (see example in the attachment). On the "raw" sheet are the data what I got for processing. I would like to have a macro which will count average of data in column "D" for every month separately. Then the result will be loaded to a table like you can see on the "avg" sheet. The macro should be executable by hitting the "count" button. Pivot table is not applicable as this is just a part of a complex solution where pivot table can not be used.

    All replies are appreciated.

    Thank you in advance.
    Attached Files Attached Files
    Last edited by Link; 07-12-2011 at 09:36 AM.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: Count average per month

    Hi,

    The data in column A is currently in 2 different formats. Some are dates, others are text. Will this be the case in your application, or is there a standard format the column will be in?
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    02-07-2008
    Posts
    60

    Re: Count average per month

    Hi sweep,

    Sorry for this, it's my mistake. It will be always in date format.

    Thank you

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,454

    Re: Count average per month

    Hi, give this a go?

    Please Login or Register  to view this content.

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Count average per month

    or

    PHP Code: 
    =SUMPRODUCT((TEXT(A2:A3000,"yyyymm")="201103")*(D2:D3000))/SUMPRODUCT((TEXT(A2:A3000,"yyyymm")="201103")*1



  6. #6
    Registered User
    Join Date
    02-07-2008
    Posts
    60

    Re: Count average per month

    Thank you very much sweep. It works perfectly!

+ 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