Solved

Date help, within 60 days of Dec or June

Posted on 2014-09-24
5
128 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

635 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