INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Need to Calculate an Expiration Date depending on Purchase Dates for a Membership

Need to Calculate an Expiration Date depending on Purchase Dates for a Membership

Need to Calculate an Expiration Date depending on Purchase Dates for a Membership

(OP)
This is hard to explain so I hope I can and that I've worded it correctly.

Need to calculate an expiration date:

row_nbr id purchase_date expiration date that needs to be calculated
1 1 03/29/2012 03/29/2013 - add 1 year
2 1 02/19/2013 03/29/2014 - since this member purchased their next membership BEFORE the 1st one expired, 2 years are added to the 1st purchase date
3 1 02/19/2014 03/29/2015 - since this member purchased their next membership BEFORE the 2nd one expired, 3 years are added to the 1st purchase date
4 1 02/17/2015 03/29/2016 - since this member purchased their next membership BEFORE the 3rd one expired, 4 years are added to the 1st purchase date

1 2 08/28/2013 08/28/2014 - add 1 year

1 3 08/28/2007 08/28/2008 - add 1 year
2 3 12/09/2008 12/09/2009 - since this member purchased their next membership AFTER the 1st one expired, 1 year is added to this 2nd purchase date
3 3 12/03/2009 12/09/2010 - since this member purchased their next membership BEFORE the 2nd one expired, 2 years is added to the 2nd purchase date
4 3 12/08/2010 12/09/2011 - since this member purchased their next membership BEFORE the 3rd one expired, 3 years are added to the 2nd purchase date
5 3 12/12/2011 12/12/2012 - since this member purchased their next membership AFTER the 4th one expired, 1 year is added to this 5th purchase date
6 3 12/17/2012 12/17/2013 - since this member purchased their next membership AFTER the 5th one expired, 1 year is added to this 6th purchase date
7 3 12/06/2013 12/17/2014 - since this member purchased their next membership BEFORE the 6th one expired, 2 years is added to the 6th purchase date
8 3 11/21/2014 12/17/2015 - since this member purchased their next membership BEFORE the 7th one expired, 3 years is added to the 6th purchase date
9 3 03/02/2016 03/02/2017 - since this member purchased their next membership AFTER the 8th one expired, 1 year is added to this 9th purchase date

1 4 08/25/2008 08/25/2009 - add 1 year
2 4 03/04/2010 03/04/2011 - since this member purchased their next membership AFTER the 1st one expired, 1 year is added to this 2nd purchase date
3 4 11/15/2010 03/04/2012 - since this member purchased their next membership BEFORE the 2nd one expired, 2 years is added to the 2nd purchase date
4 4 02/15/2012 03/04/2013 - since this member purchased their next membership BEFORE the 3rd one expired, 3 years is added to the 2nd purchase date
5 4 02/15/2013 03/04/2014 - since this member purchased their next membership BEFORE the 4th one expired, 4 years is added to the 2nd purchase date
6 4 03/26/2014 03/26/2015 - since this member purchased their next membership AFTER the 5th one expired, 1 year is added to this 6th purchase date
7 4 08/03/2015 08/03/2016 - since this member purchased their next membership AFTER the 6th one expired, 1 year is added to this 7th purchase date

Help would be very appreciated!

RE: Need to Calculate an Expiration Date depending on Purchase Dates for a Membership

Why not just add 1 year to the last expiration date? It ends up being the same date, doesn't it?

RE: Need to Calculate an Expiration Date depending on Purchase Dates for a Membership

(OP)
It won't work if I understand what you are saying because like the example for id 4

row_nbr id purchase_date expiration date that needs to be calculated
1 4 08/25/2008 08/25/2009 - add 1 year
2 4 03/04/2010 03/04/2011 - since this member purchased their next membership AFTER the 1st one expired, 1 year is added to this 2nd purchase date
3 4 11/15/2010 03/04/2012 - since this member purchased their next membership BEFORE the 2nd one expired, 2 years is added to the 2nd purchase date
4 4 02/15/2012 03/04/2013 - since this member purchased their next membership BEFORE the 3rd one expired, 3 years is added to the 2nd purchase date

5 4 02/15/2013 03/04/2014 - since this member purchased their next membership BEFORE the 4th one expired, 4 years is added to the 2nd purchase date

6 4 03/26/2014 03/26/2015 - since this member purchased their next membership AFTER the 5th one expired, 1 year is added to this 6th purchase date

7 4 08/03/2015 08/03/2016 - since this member purchased their next membership AFTER the 6th one expired, 1 year is added to this 7th purchase date

Row 5: If I add 1 year to this expiration date 03/04/2014 then row 6 would have an expiration date of 03/04/2015 but it has to be 03/26/2015 since the next purchase date of 03/26/2014 is after 03/04/2014.

Thanks

RE: Need to Calculate an Expiration Date depending on Purchase Dates for a Membership

You'll need to explain #4, because on the surface it looks the same as #3. The purchase was one year plus change prior to the expiration, so what makes that a +4 instead of a +3?

RE: Need to Calculate an Expiration Date depending on Purchase Dates for a Membership

I'm sorry, I should have said the purchase date. Why not add 1 year to the last purchase date?
If purchase date > expiration date Then add 1 year to purchase date
else add 1 year to expiration date

RE: Need to Calculate an Expiration Date depending on Purchase Dates for a Membership

(OP)
Hi Charliy,

Row 4 would be +3 because they purchased their 2nd one on 03/04/2010 and that is after the 08/25/2009 (row 1) expiration date. This is hard to explain. How the next expiration date is calculated depends if they purchased their next membership before or after their previous expiration date.

Thanks

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close