Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How to average values based on time period

I have a table with several columns: two of which are labeled Date and Value.
I want to extract the average from the Value column based on a date
criteria. For example, what is the average value for the last week? For the
last month? For the last year? Can I do this with DAVG and, if so, what
should the criteria be? If not, is there a formula I can use to get this
done?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How to average values based on time period

You can use array formulas** like these.

For the week, use cells to hold to the dates for the week:

A1 = start date
B1 = end date
D1:D10 = dates
E1:E10 = values to average

*All* of these formulas need to be array entered**.

=AVERAGE(IF(D1:D10=A1,IF(D1:D10<=B1,E1:E10)))

For the month:

=AVERAGE(IF(MONTH(D1:D10)=n,E1:E10))

Where n = the month number: Jan = 1 to Dec = 12

For the year:

=AVERAGE(IF(YEAR(D1:D10)=n,E1:E10))

Where n = the year number: 2009, 2008, etc.

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Peters48" wrote in message
...
I have a table with several columns: two of which are labeled Date and
Value.
I want to extract the average from the Value column based on a date
criteria. For example, what is the average value for the last week? For
the
last month? For the last year? Can I do this with DAVG and, if so, what
should the criteria be? If not, is there a formula I can use to get this
done?



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How to average values based on time period

Your formula would work except the Date and Value field values are being
imported into Excel from a 3d party application and, so far, there are close
to 800 rows in the table. So, unless there's a way to convert all of them to
array values easily (i.e., not individually & manually), it would be too
time-consuming to have to constantly reformat all these imported values each
time I import the 3d party application's data.

"T. Valko" wrote:

You can use array formulas** like these.

For the week, use cells to hold to the dates for the week:

A1 = start date
B1 = end date
D1:D10 = dates
E1:E10 = values to average

*All* of these formulas need to be array entered**.

=AVERAGE(IF(D1:D10=A1,IF(D1:D10<=B1,E1:E10)))

For the month:

=AVERAGE(IF(MONTH(D1:D10)=n,E1:E10))

Where n = the month number: Jan = 1 to Dec = 12

For the year:

=AVERAGE(IF(YEAR(D1:D10)=n,E1:E10))

Where n = the year number: 2009, 2008, etc.

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Peters48" wrote in message
...
I have a table with several columns: two of which are labeled Date and
Value.
I want to extract the average from the Value column based on a date
criteria. For example, what is the average value for the last week? For
the
last month? For the last year? Can I do this with DAVG and, if so, what
should the criteria be? If not, is there a formula I can use to get this
done?



.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How to average values based on time period

unless there's a way to convert all of them to
array values easily


I don't understand what that means. Convert what to array values?

--
Biff
Microsoft Excel MVP


"Peters48" wrote in message
...
Your formula would work except the Date and Value field values are being
imported into Excel from a 3d party application and, so far, there are
close
to 800 rows in the table. So, unless there's a way to convert all of them
to
array values easily (i.e., not individually & manually), it would be too
time-consuming to have to constantly reformat all these imported values
each
time I import the 3d party application's data.

"T. Valko" wrote:

You can use array formulas** like these.

For the week, use cells to hold to the dates for the week:

A1 = start date
B1 = end date
D1:D10 = dates
E1:E10 = values to average

*All* of these formulas need to be array entered**.

=AVERAGE(IF(D1:D10=A1,IF(D1:D10<=B1,E1:E10)))

For the month:

=AVERAGE(IF(MONTH(D1:D10)=n,E1:E10))

Where n = the month number: Jan = 1 to Dec = 12

For the year:

=AVERAGE(IF(YEAR(D1:D10)=n,E1:E10))

Where n = the year number: 2009, 2008, etc.

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the
SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Peters48" wrote in message
...
I have a table with several columns: two of which are labeled Date and
Value.
I want to extract the average from the Value column based on a date
criteria. For example, what is the average value for the last week?
For
the
last month? For the last year? Can I do this with DAVG and, if so,
what
should the criteria be? If not, is there a formula I can use to get
this
done?



.



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default How to average values based on time period


I misunderstood your directions (the whole "array" thing has baffled me
since I started using Excel in the early '80s). Your formulas do what I
couldn't figure out how to do. Thanks for your help.


"T. Valko" wrote:

unless there's a way to convert all of them to
array values easily


I don't understand what that means. Convert what to array values?

--
Biff
Microsoft Excel MVP


"Peters48" wrote in message
...
Your formula would work except the Date and Value field values are being
imported into Excel from a 3d party application and, so far, there are
close
to 800 rows in the table. So, unless there's a way to convert all of them
to
array values easily (i.e., not individually & manually), it would be too
time-consuming to have to constantly reformat all these imported values
each
time I import the 3d party application's data.

"T. Valko" wrote:

You can use array formulas** like these.

For the week, use cells to hold to the dates for the week:

A1 = start date
B1 = end date
D1:D10 = dates
E1:E10 = values to average

*All* of these formulas need to be array entered**.

=AVERAGE(IF(D1:D10=A1,IF(D1:D10<=B1,E1:E10)))

For the month:

=AVERAGE(IF(MONTH(D1:D10)=n,E1:E10))

Where n = the month number: Jan = 1 to Dec = 12

For the year:

=AVERAGE(IF(YEAR(D1:D10)=n,E1:E10))

Where n = the year number: 2009, 2008, etc.

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the
SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Peters48" wrote in message
...
I have a table with several columns: two of which are labeled Date and
Value.
I want to extract the average from the Value column based on a date
criteria. For example, what is the average value for the last week?
For
the
last month? For the last year? Can I do this with DAVG and, if so,
what
should the criteria be? If not, is there a formula I can use to get
this
done?


.



.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default How to average values based on time period

Ok, good deal.

See if this helps to shed some light about array formulas:

http://www.cpearson.com/Excel/ArrayFormulas.aspx

--
Biff
Microsoft Excel MVP


"Peters48" wrote in message
...

I misunderstood your directions (the whole "array" thing has baffled me
since I started using Excel in the early '80s). Your formulas do what I
couldn't figure out how to do. Thanks for your help.


"T. Valko" wrote:

unless there's a way to convert all of them to
array values easily


I don't understand what that means. Convert what to array values?

--
Biff
Microsoft Excel MVP


"Peters48" wrote in message
...
Your formula would work except the Date and Value field values are
being
imported into Excel from a 3d party application and, so far, there are
close
to 800 rows in the table. So, unless there's a way to convert all of
them
to
array values easily (i.e., not individually & manually), it would be
too
time-consuming to have to constantly reformat all these imported values
each
time I import the 3d party application's data.

"T. Valko" wrote:

You can use array formulas** like these.

For the week, use cells to hold to the dates for the week:

A1 = start date
B1 = end date
D1:D10 = dates
E1:E10 = values to average

*All* of these formulas need to be array entered**.

=AVERAGE(IF(D1:D10=A1,IF(D1:D10<=B1,E1:E10)))

For the month:

=AVERAGE(IF(MONTH(D1:D10)=n,E1:E10))

Where n = the month number: Jan = 1 to Dec = 12

For the year:

=AVERAGE(IF(YEAR(D1:D10)=n,E1:E10))

Where n = the year number: 2009, 2008, etc.

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the
SHIFT
key then hit ENTER.

--
Biff
Microsoft Excel MVP


"Peters48" wrote in message
...
I have a table with several columns: two of which are labeled Date
and
Value.
I want to extract the average from the Value column based on a date
criteria. For example, what is the average value for the last week?
For
the
last month? For the last year? Can I do this with DAVG and, if so,
what
should the criteria be? If not, is there a formula I can use to get
this
done?


.



.



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 833
Default How to average values based on time period

1. I reckon that this can be done through a Pivot Table.

2. I have just uploaded a file called:-

Peters48.xlsx

- to:-

www.pierrefondes.com

3. The above file will be item number 33 towards the top of the page.

I have left my rough workings in here as well (and my checks on the Pivot
Table calculations).

Pivot Table starts at cell L 1.

4. Your 2 columns of data start at cell A 9 and are highlighted in yellow.

I have only done last week and last month figures and the numbers in the
Pivot Table agree to my manual calculations.

5. When you first go into Pivot Table you will see:-

35 for January (this number checks out and is correct)

16 for December (again this number checks out and is correct).

6. If you want to see the number for last week take the following action:-

- click in cell M 2 (this has the word Jan in it)

- PivotTable Tools / Options / Group group / Group Field

- Grouping window should launch

- de-select Months (which should be highlighted)

- select Days

- change Starting at: date to read 28/12/2009 (make sure box to left NOT
ticked)

- change Ending at: date to read 03/01/2010 (make sure box to left ticked)

- change Number of days: to 7

- Hit OK.

7. Pivot Table will now change.

In cell N 2 you will get description:-

28/12/2009 €“ 03/01/2010

- and beneath that you will get the number 31.

This is the 31 average for last week and agrees with my manual calculation
in cell F 43.

Hope that the above has helped you out.

If it has please hit Yes.

Thanks!



"Peters48" wrote:

I have a table with several columns: two of which are labeled Date and Value.
I want to extract the average from the Value column based on a date
criteria. For example, what is the average value for the last week? For the
last month? For the last year? Can I do this with DAVG and, if so, what
should the criteria be? If not, is there a formula I can use to get this
done?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Max Value - based on a time period Chris26 Excel Worksheet Functions 3 June 22nd 09 03:53 PM
Spreading an amount over a period of time based on predetermined % RL Excel Worksheet Functions 0 October 3rd 07 05:25 PM
I have a problem with conditional formulas based on a time period DaveOfArkansas Excel Worksheet Functions 4 December 30th 06 11:25 AM
conditional formulas based on a time period Lisa Excel Worksheet Functions 5 December 22nd 06 06:46 PM
average rate of change per given time period between 2 moments in time of a value David Virgil Hobbs Excel Worksheet Functions 1 December 19th 06 07:24 AM


All times are GMT +1. The time now is 04:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"