Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Daily and Monthly Average Macro

Hello,
I need some help to make a macro that look up for values on a specific day
and month to make an average. Here I show how it looks

A B C
Day Hour Value
01/01/05 8:00 10
01/01/05 9:00 11
01/01/05 10:00 20

02/01/05 8:00 25
03/01/05 8:00 30

The macro should be able to make an average of the day entered (01/01/05) by
the user and for a second option doing it with the moth.

If the day entered by the user is in the column A I need to store the value
and go on to the second line to do the same, storing the value to get the
average of them as an output

Same with the monthly average but searching the /mm/ space

Any help is welcome Im just need a hand to start
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Daily and Monthly Average Macro

Have you considered using a pivot table and grouping ont the time field. It
avoids a whole pile of messy code and gives you a lot more options... If you
need help just ask...
--
HTH...

Jim Thomlinson


"snake" wrote:

Hello,
I need some help to make a macro that look up for values on a specific day
and month to make an average. Here I show how it looks

A B C
Day Hour Value
01/01/05 8:00 10
01/01/05 9:00 11
01/01/05 10:00 20

02/01/05 8:00 25
03/01/05 8:00 30

The macro should be able to make an average of the day entered (01/01/05) by
the user and for a second option doing it with the moth.

If the day entered by the user is in the column A I need to store the value
and go on to the second line to do the same, storing the value to get the
average of them as an output

Same with the monthly average but searching the /mm/ space

Any help is welcome Im just need a hand to start

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Daily and Monthly Average Macro

Why use a macro? Put the test date in D1 and use

=AVERAGE(IF((YEAR(A2:A100)=YEAR(D1))*(MONTH(A2:A10 0)=MONTH(D1))*(DAY(A2:A100
)=DAY(D1)),C2:C100))

and

=AVERAGE(IF((YEAR(A2:A100)=YEAR(D1))*(MONTH(A2:A10 0)=MONTH(D1)),C2:C100))

both array formulae so commit with Ctrl-Shift-Enter.



--
HTH

Bob Phillips

"snake" wrote in message
...
Hello,
I need some help to make a macro that look up for values on a specific day
and month to make an average. Here I show how it looks

A B C
?
The macro should be able to make an average of the day entered (01/01/05)

by
the user and for a second option doing it with the moth.

If the day entered by the user is in the column A I need to store the

value
and go on to the second line to do the same, storing the value to get the
average of them as an output

Same with the monthly average but searching the /mm/ space

Any help is welcome Im just need a hand to start



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Daily and Monthly Average Macro

Great simple solution, thank you very much

"Bob Phillips" wrote:

Why use a macro? Put the test date in D1 and use

=AVERAGE(IF((YEAR(A2:A100)=YEAR(D1))*(MONTH(A2:A10 0)=MONTH(D1))*(DAY(A2:A100
)=DAY(D1)),C2:C100))

and

=AVERAGE(IF((YEAR(A2:A100)=YEAR(D1))*(MONTH(A2:A10 0)=MONTH(D1)),C2:C100))

both array formulae so commit with Ctrl-Shift-Enter.



--
HTH

Bob Phillips

"snake" wrote in message
...
Hello,
I need some help to make a macro that look up for values on a specific day
and month to make an average. Here I show how it looks

A B C
?
The macro should be able to make an average of the day entered (01/01/05)

by
the user and for a second option doing it with the moth.

If the day entered by the user is in the column A I need to store the

value
and go on to the second line to do the same, storing the value to get the
average of them as an output

Same with the monthly average but searching the /mm/ space

Any help is welcome Im just need a hand to start




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
Daily totals from a monthly log Dhardy Excel Worksheet Functions 1 April 24th 10 03:05 AM
Daily / Monthly Chart :)[_2_] Charts and Charting in Excel 1 December 31st 09 02:14 PM
sum daily production data to monthly olga Excel Worksheet Functions 4 March 9th 09 11:26 PM
HOW DO I FREEZE DATA THAT CHANGES DAILY. dAILY/MONTHLY BUDGET mike64149 Excel Discussion (Misc queries) 4 September 22nd 08 08:11 PM
Daily,monthly total nowfal Excel Discussion (Misc queries) 3 September 26th 05 09:33 PM


All times are GMT +1. The time now is 01:11 AM.

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"