Solved

Date help, within 60 days of Dec or June

Posted on 2014-09-24
5
127 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel shared spreadsheet 12 38
excel spreadsheet word wrap 6 34
Vlookup Help 3 29
VBA - How to copy the data from workbook to workbook masterfile in VBA? 19 45
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

751 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