Solved

# YearToDate function for past years?

Posted on 2006-05-18
569 Views
How do I right a formula to retrieve YTD data for past years, I know the function for last year is LastYearYTD but what about prior years like 2004 and 2003, etc.  I assume this has to be fairly simple and straight forward but I can't seem to figure it out.

Example:
If {trade.settle_i} in LastYearYTD-1 Then
Else
0

Thanks for your help!

Brian
0
Question by:IO_Dork

LVL 42

Accepted Solution

One way is to add a year to 2004 (making it 2005) and then do a LastYear comparison:

0

LVL 42

Expert Comment

Or a more generic formula that compares the month & day regardless of year:

if DATE(year(currentdate), month({trade.settle_i}), day({trade.settle_i}) < currentdate then ...

0

Author Comment

I am not sure if it makes a difference but I want to show YTD for the last five years or so, i.e. - this year 2006, along with 2005, 2004, 2003, 2002, 2001 and 2000.  Does your first formula work in this case?
0

LVL 42

Expert Comment

No, you'd have to do +1 Or +2, etc.  The second formula however will work for every year so if you want to see everything you can use this formula as is.  If you want year 2000+ then do this (I assume you want this in the record selection formula?):

and
0

Author Comment

i used the first formula for all years and it worked great! Thanks!
0

## Write Comment

Please enter a first name

Please enter a last name

We will never share this with anyone.

## Featured Post

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

#### 779 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

#### Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!