View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Summing the last records of every month.

Really, it doesn't appear that you want the last day of the month at all.
As I see it, you actually want the last account record for each month
regardless of which day it is posted on which may not be the last day of the
month. I assume it isn't necessarily and probably isn't the max record in
that month for that account since accounts can have a withdrawal.


--
Regards,
Tom Ogilvy

"Richard Buttrey" wrote in
message ...
On Thu, 31 Mar 2005 11:49:59 -0500, "Tom Ogilvy"
wrote:

Assuming the records are sorted by date ascending (column B) starting in

B2
to B366 or B367 [leap year], sum the values in E for the last record for
each month.
=SUMPRODUCT(E2:E367,--(MONTH(B2:B367)<MONTH(B3:B368)))


Hi Tom,

Thanks for this.

Like an idiot I forgot to mention one crucial (I guess) point. The
records are in fact bank accounts, and there are several bank account
records per day - althought not necessarily the same number per day.

I'm looking to have the cumulative monthly sum total - For Each Bank
Account - outside the database, rather than as an additional column in
the database. Which is why I've been experimenting with array formulae
which match the bank account in question, and then, which is where I'm
struggling, also match the last record for each month.

e.g

Bank1 1/4/2005 200
Bank2 1/4/2005 100
Bank1 4/4/2005 300
Bank2 4/4/2005 50
Bank1 6/5/2005 20
Bank2 8/5/2005 40
Bank2 30/5/2005 200

Answers required for cumulative monthly totals between 1/4/2005 and
31/5/2005 (English date notation)

Bank 1 320 i.e. last cum in April 300, plus last May cum 20
Bank2 250 last cum in April 50, plus last May cum 200

Kind regards,

Richard


__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________