Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default hello again... complicated macro using dates

hello me again.
i've had a look at previous posts but am still a bit stuck!

i have a workbook.
there are two worksheets.
one is for 2004 and one is for 2005, soon I will have 2005 and 2006, but we
can talk about that later.
there are various columns.
i am particularly looking at two... date column and amount column.
the date column does not run sequentially, the dates are ad hoc, eg, they do
not run 21/22/23 it may be 20/22/23/27.
i have a macro which will add the values in the amount columns from both
sheets.
but what i would like it to do is...
look at today's date, and find the corresponding date in the 2004 sheet and
add everything from that date on, so it is effectively a 12 month rolling
period.
any suggestions would be greatly appreciated.
thanks in advance

mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default hello again... complicated macro using dates

The SUMIF worksheet function should be able to do this - for the prior year's
sheet it would be (substituting in the proper addresses for the date range
and amount range):
=SUMIF(DateRange,"="&TEXT(DATE(YEAR(TODAY())-1,MONTH(TODAY()),DAY(TODAY())),"mm/dd/yy"),AmountRange)
I assume you can figure the total from the current year, since presumably
all amounts are before today's date, but if not the form of the formula would
be the same.
--
- K Dales


"mike" wrote:

hello me again.
i've had a look at previous posts but am still a bit stuck!

i have a workbook.
there are two worksheets.
one is for 2004 and one is for 2005, soon I will have 2005 and 2006, but we
can talk about that later.
there are various columns.
i am particularly looking at two... date column and amount column.
the date column does not run sequentially, the dates are ad hoc, eg, they do
not run 21/22/23 it may be 20/22/23/27.
i have a macro which will add the values in the amount columns from both
sheets.
but what i would like it to do is...
look at today's date, and find the corresponding date in the 2004 sheet and
add everything from that date on, so it is effectively a 12 month rolling
period.
any suggestions would be greatly appreciated.
thanks in advance

mike

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
Difference between dates, but a bit more complicated Leyla Excel Discussion (Misc queries) 2 September 10th 09 11:50 PM
Need Help with Complicated Array Macro Jaime Excel Discussion (Misc queries) 1 August 27th 08 10:05 PM
HELP with complicated macro JackR Excel Discussion (Misc queries) 0 March 20th 06 07:00 PM
How do I do this complicated macro??? tweacle Excel Worksheet Functions 1 March 4th 06 05:00 PM
One more and I'll finish this complicated macro Duncan_J Excel Programming 1 November 16th 04 04:39 PM


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

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"