Solved

Date help, within 60 days of Dec or June

Posted on 2014-09-24
5
123 Views
Last Modified: 2014-09-25
How would I modify the following for 60 days before December 31 and June 30.  So, bassed on today, the return would be 60 days before Dec 31 and when that day is passed then 60 days before June 30.

not sure if there is more simple formula out there.  Maybe using EOMonth possibly.   I dont understand the below formula.
DATE(YEAR(NOW()),CHOOSE(MONTH(NOW()),IF(DAY(NOW())>15,6,0),6,6,6,6,6,IF(DAY(NOW())>15,12,6),12,12,12,12,12),0)

thank you
0
Comment
Question by:pdvsa
  • 3
  • 2
5 Comments
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 500 total points
ID: 40342448
The above formula returns 11/30/2014 in relation to today's date (9/24/2014).  I presume you expect 11/1/2014 instead (60 days before 12/31/2014).

So if
1/1 through 5/1 ===> 5/1 (60 days before June 30, current year)
5/2 through 11/1 ===> 11/1 (60 days before Dec 31, current year)
11/2 through 12/31 ===> 5/1 (60 days before June 30, next year)

If this assumption is correct then this formula will produce the result:
=IF(NOW()<=DATE(YEAR(NOW()),5,1),DATE(YEAR(NOW()),5,1),IF(NOW()<=DATE(YEAR(NOW()),11,1),DATE(YEAR(NOW()),11,1),DATE(YEAR(NOW())+1,5,1)))

Regards,
-Glenn
0
 

Author Closing Comment

by:pdvsa
ID: 40342622
very nice!  You are obviously very good at this.
0
 

Author Comment

by:pdvsa
ID: 40342662
hope you are still monitoring.  I actually had it made a mistake.  I said before 60 days but it should be after 60 days from June 30 / Dec 31.  I dont see how to modify that.  Its too complicated.  Can you make that edit?  thank you
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40343232
Pretty big mistake! :-)

If I replace "before" with "after" in your original statement:
How would I modify the following for 60 days after December 31 and June 30.  So, based on today, the return would be 60 days after Dec 31 and when that day is passed then 60 days after June 30.

So if:
1/1 through 2/29 or 3/1 ===> 2/29 or 3/1 (60 days after Dec 31, in current year, depends on if a leap year)
3/1 or 3/2 through 8/29 ===> 8/29 (60 days after June 30, current year, depending on if a leap year)
8/30 through 12/31 ====> 2/29 or 3/1 (60 days after Dec 31, next year)

 If this assumption is correct then this formula will produce the result:
=IF(NOW()<=DATE(YEAR(NOW()),2,29),DATE(YEAR(NOW()),2,29),IF(NOW()>=DATE(YEAR(NOW()),8,30),DATE(YEAR(NOW()),12,31)+60,DATE(YEAR(NOW()),8,29)))

Note that the first DATE function - DATE(YEAR(NOW()),2,29) - is tricking Excel to show either 2/29 or 3/1, depending on if it is a leap year.

Any other changes...you gotta ask a new question! :-D

-Glenn
0
 

Author Comment

by:pdvsa
ID: 40343921
you are really really good at this.  I hope you make a lot of money doing this.  

thank you.  

will probably post another similar question in a bit.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

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

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

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now