Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Sum for last calendar month & year

I have a spreadsheet with column H = date and column J is a numerical
value. I am looking for a way to sum all entries in the last calendar
month and also for the last calendar year (Jan1 -Dec 31).

Can anyone help me with this?


Jim

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Sum for last calendar month & year

Try something like this:

With
Dates in A1:A40
Values in B1:B40

The total for the month prior to today's month:
C1: =SUMPRODUCT(--(TEXT(A1:A40,"yyyymm")=TEXT(TODAY()-DAY(TODAY()),"yyyymm")))

The total for the year prior to today's year:
C2: =SUMPRODUCT(--(YEAR(A1:A40)=(YEAR(TODAY())-1)))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

I have a spreadsheet with column H = date and column J is a numerical
value. I am looking for a way to sum all entries in the last calendar
month and also for the last calendar year (Jan1 -Dec 31).

Can anyone help me with this?


Jim


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Sum for last calendar month & year

Thanks for the tip but I don't think it's quite what I need. The
spreadsheet column H containes dates for all entries. I want to produce
a sum of column J for all entries dated in the last calendar month
without the need to specify the month.

Jim


Ron Coderre wrote:
Try something like this:

With
Dates in A1:A40
Values in B1:B40

The total for the month prior to today's month:
C1: =SUMPRODUCT(--(TEXT(A1:A40,"yyyymm")=TEXT(TODAY()-DAY(TODAY()),"yyyymm")))

The total for the year prior to today's year:
C2: =SUMPRODUCT(--(YEAR(A1:A40)=(YEAR(TODAY())-1)))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

I have a spreadsheet with column H = date and column J is a numerical
value. I am looking for a way to sum all entries in the last calendar
month and also for the last calendar year (Jan1 -Dec 31).

Can anyone help me with this?


Jim



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Sum for last calendar month & year

A couple questions....
If you don't know what month you're in, how will you know what last month is?
Are the dates for just one month?
year to date through last month?
All history through yesterday?

Can you describe the data in a bit more detail?
Are there any constraints we should be aware of?

***********
Regards,
Ron

XL2002, WinXP


" wrote:

Thanks for the tip but I don't think it's quite what I need. The
spreadsheet column H containes dates for all entries. I want to produce
a sum of column J for all entries dated in the last calendar month
without the need to specify the month.

Jim


Ron Coderre wrote:
Try something like this:

With
Dates in A1:A40
Values in B1:B40

The total for the month prior to today's month:
C1: =SUMPRODUCT(--(TEXT(A1:A40,"yyyymm")=TEXT(TODAY()-DAY(TODAY()),"yyyymm")))

The total for the year prior to today's year:
C2: =SUMPRODUCT(--(YEAR(A1:A40)=(YEAR(TODAY())-1)))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

I have a spreadsheet with column H = date and column J is a numerical
value. I am looking for a way to sum all entries in the last calendar
month and also for the last calendar year (Jan1 -Dec 31).

Can anyone help me with this?


Jim




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Sum for last calendar month & year

Hi Ron

I was hoping that Excel could determine the last month based on the
current date TODAY(). It would look at the current month and Sum the J
field for the previous month.

The spreadsheet holds several years of data and all dates are in a
column formatted as Date dd-mmm-yyyy

The last calendar year function would look at all entries in the
previous year Jan 1 thru Dec 31. If the current date is in 2006 it
would look at all entries dated 2005.

Does that explain it any better?

Jim



Ron Coderre wrote:
A couple questions....
If you don't know what month you're in, how will you know what last month is?
Are the dates for just one month?
year to date through last month?
All history through yesterday?

Can you describe the data in a bit more detail?
Are there any constraints we should be aware of?

***********
Regards,
Ron

XL2002, WinXP


" wrote:

Thanks for the tip but I don't think it's quite what I need. The
spreadsheet column H containes dates for all entries. I want to produce
a sum of column J for all entries dated in the last calendar month
without the need to specify the month.

Jim


Ron Coderre wrote:
Try something like this:

With
Dates in A1:A40
Values in B1:B40

The total for the month prior to today's month:
C1: =SUMPRODUCT(--(TEXT(A1:A40,"yyyymm")=TEXT(TODAY()-DAY(TODAY()),"yyyymm")))

The total for the year prior to today's year:
C2: =SUMPRODUCT(--(YEAR(A1:A40)=(YEAR(TODAY())-1)))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

I have a spreadsheet with column H = date and column J is a numerical
value. I am looking for a way to sum all entries in the last calendar
month and also for the last calendar year (Jan1 -Dec 31).

Can anyone help me with this?


Jim







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Sum for last calendar month & year

Um...out of curiosity....
Did you try the formulas I posted?
(They do just what you described.)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

Hi Ron

I was hoping that Excel could determine the last month based on the
current date TODAY(). It would look at the current month and Sum the J
field for the previous month.

The spreadsheet holds several years of data and all dates are in a
column formatted as Date dd-mmm-yyyy

The last calendar year function would look at all entries in the
previous year Jan 1 thru Dec 31. If the current date is in 2006 it
would look at all entries dated 2005.

Does that explain it any better?

Jim



Ron Coderre wrote:
A couple questions....
If you don't know what month you're in, how will you know what last month is?
Are the dates for just one month?
year to date through last month?
All history through yesterday?

Can you describe the data in a bit more detail?
Are there any constraints we should be aware of?

***********
Regards,
Ron

XL2002, WinXP


" wrote:

Thanks for the tip but I don't think it's quite what I need. The
spreadsheet column H containes dates for all entries. I want to produce
a sum of column J for all entries dated in the last calendar month
without the need to specify the month.

Jim


Ron Coderre wrote:
Try something like this:

With
Dates in A1:A40
Values in B1:B40

The total for the month prior to today's month:
C1: =SUMPRODUCT(--(TEXT(A1:A40,"yyyymm")=TEXT(TODAY()-DAY(TODAY()),"yyyymm")))

The total for the year prior to today's year:
C2: =SUMPRODUCT(--(YEAR(A1:A40)=(YEAR(TODAY())-1)))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

I have a spreadsheet with column H = date and column J is a numerical
value. I am looking for a way to sum all entries in the last calendar
month and also for the last calendar year (Jan1 -Dec 31).

Can anyone help me with this?


Jim






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Sum for last calendar month & year

Hi Ron

I must be missing something then because all I get when I use either
formula is a Parse Error.

Jim


Ron Coderre wrote:
Um...out of curiosity....
Did you try the formulas I posted?
(They do just what you described.)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

Hi Ron

I was hoping that Excel could determine the last month based on the
current date TODAY(). It would look at the current month and Sum the J
field for the previous month.

The spreadsheet holds several years of data and all dates are in a
column formatted as Date dd-mmm-yyyy

The last calendar year function would look at all entries in the
previous year Jan 1 thru Dec 31. If the current date is in 2006 it
would look at all entries dated 2005.

Does that explain it any better?

Jim



Ron Coderre wrote:
A couple questions....
If you don't know what month you're in, how will you know what last month is?
Are the dates for just one month?
year to date through last month?
All history through yesterday?

Can you describe the data in a bit more detail?
Are there any constraints we should be aware of?

***********
Regards,
Ron

XL2002, WinXP


" wrote:

Thanks for the tip but I don't think it's quite what I need. The
spreadsheet column H containes dates for all entries. I want to produce
a sum of column J for all entries dated in the last calendar month
without the need to specify the month.

Jim


Ron Coderre wrote:
Try something like this:

With
Dates in A1:A40
Values in B1:B40

The total for the month prior to today's month:
C1: =SUMPRODUCT(--(TEXT(A1:A40,"yyyymm")=TEXT(TODAY()-DAY(TODAY()),"yyyymm")))

The total for the year prior to today's year:
C2: =SUMPRODUCT(--(YEAR(A1:A40)=(YEAR(TODAY())-1)))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

I have a spreadsheet with column H = date and column J is a numerical
value. I am looking for a way to sum all entries in the last calendar
month and also for the last calendar year (Jan1 -Dec 31).

Can anyone help me with this?


Jim







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,118
Default Sum for last calendar month & year

Parse error? Not sure where that would be coming from. You should be able to
copy the below formulas into your workbook. (I changed the column refs for
dates and values to H and J, respectively.

The total for the month prior to today's month:
=SUMPRODUCT(--(TEXT(H1:H40,"yyyymm")=TEXT(TODAY()-DAY(TODAY()),"yyyymm")))

The total for the year prior to today's year:
=SUMPRODUCT(--(YEAR(H1:H40)=(YEAR(TODAY())-1)))

Note: in case text wrap impacts the display, there are NO spaces or line
breaks in those formulas.

Does that help?

If No....please post the formula you are using. We'll see if we can spot
the issue.

***********
Regards,
Ron

XL2002, WinXP


" wrote:

Hi Ron

I must be missing something then because all I get when I use either
formula is a Parse Error.

Jim


Ron Coderre wrote:
Um...out of curiosity....
Did you try the formulas I posted?
(They do just what you described.)

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

Hi Ron

I was hoping that Excel could determine the last month based on the
current date TODAY(). It would look at the current month and Sum the J
field for the previous month.

The spreadsheet holds several years of data and all dates are in a
column formatted as Date dd-mmm-yyyy

The last calendar year function would look at all entries in the
previous year Jan 1 thru Dec 31. If the current date is in 2006 it
would look at all entries dated 2005.

Does that explain it any better?

Jim



Ron Coderre wrote:
A couple questions....
If you don't know what month you're in, how will you know what last month is?
Are the dates for just one month?
year to date through last month?
All history through yesterday?

Can you describe the data in a bit more detail?
Are there any constraints we should be aware of?

***********
Regards,
Ron

XL2002, WinXP


" wrote:

Thanks for the tip but I don't think it's quite what I need. The
spreadsheet column H containes dates for all entries. I want to produce
a sum of column J for all entries dated in the last calendar month
without the need to specify the month.

Jim


Ron Coderre wrote:
Try something like this:

With
Dates in A1:A40
Values in B1:B40

The total for the month prior to today's month:
C1: =SUMPRODUCT(--(TEXT(A1:A40,"yyyymm")=TEXT(TODAY()-DAY(TODAY()),"yyyymm")))

The total for the year prior to today's year:
C2: =SUMPRODUCT(--(YEAR(A1:A40)=(YEAR(TODAY())-1)))

Does that help?
***********
Regards,
Ron

XL2002, WinXP


" wrote:

I have a spreadsheet with column H = date and column J is a numerical
value. I am looking for a way to sum all entries in the last calendar
month and also for the last calendar year (Jan1 -Dec 31).

Can anyone help me with this?


Jim








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
calendar year versus fiscal year mePenny Excel Discussion (Misc queries) 4 November 17th 09 06:05 PM
Tell me which "season" (Month/Day through Month/Day) a date(Month/Day/Year) falls in (any year)??? misscrf Excel Discussion (Misc queries) 1 December 14th 07 02:59 PM
Opening calendar form with today's month & year pkeegs Excel Discussion (Misc queries) 2 December 17th 06 07:53 PM
change the year in a calendar template to different year George Excel Discussion (Misc queries) 1 July 19th 06 07:34 PM
Calendar Control 11 - Month/Year Only ll Excel Programming 8 April 14th 06 08:23 PM


All times are GMT +1. The time now is 02:13 AM.

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

About Us

"It's about Microsoft Excel"