View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mikek Mikek is offline
external usenet poster
 
Posts: 6
Default Sum amounts based on date field

Pete, thanks for your help. The floor function worked nicely. The problem
now is I don't have values for each hour of the day. I only want to populate
Column C and D if the hour exists in column A. I hope this makes sense.

"Pete_UK" wrote:

Put this in D2:

=FLOOR(MIN(A:A),1/24)

and this in D3:

=D2+1/24

Then copy D3 down as far as you need to - you will have 1-hour
increments.

Then you can put this formula in C2:

=SUMPRODUCT((A$2:A$7=D2)*(A$2:A$7<D3),B$2:B$7)

You might need to make the ranges larger in your real data, and then
you can copy this down to one cell less than the cells used in column
D (to get the time range).

Hope this helps.

Pete


On Dec 8, 10:01 pm, MikeK wrote:
I have two columns. Column A is a date time column. Column B is an amount
column. I want to calculate the amounts by the hour and place the hourly
totals in Column C and the date time of that hour in Column D. Below is an
example of the data and how I would like Column C and Column D to look.

Column A Column B Column C Column D
DATE AMOUNT TOTALS/HR DATE
01/01/2009 01:10:10 50 75
01/01/2009 01:00:00
01/01/2009 01:20:05 25 10
01/01/2009 02:00:00
01/01/2009 02:01:00 10 45
01/01/2009 03:00:00
01/01/2009 03:05:25 15 20
01/02/2009 05:00:00
01/01/2009 03:07:59 30
01/02/2009 05:05:01 20

I posted this earlier but couldn't find my post. I guess I did it
incorrectly. Any help would be appreciated. If the alignment is skewed
below is the information per column.
Column A
DATE
01/01/2009 01:10:10
01/01/2009 01:20:05
01/01/2009 02:01:00
01/01/2009 03:05:25
01/01/2009 03:07:59
01/02/2009 05:05:01

Column B
AMOUNT
50
25
10
15
30
20

Column C
TOTALS/HR
75
10
45
20

Column D
DATE
01/01/2009 01:00:00
01/01/2009 02:00:00
01/01/2009 03:00:00
01/02/2009 05:00:00


.