Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / June 2006

Tip: Looking for answers? Try searching our database.

DATE function clarification

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jessica - 16 Jun 2006 20:40 GMT
Hi,

I have been using this formula to subtract 2 months from D15, it also gives
you the last day of the month, i.e. if D15 was May 31, the formula gives you
Feb 28 instead of Feb 31.

=MIN(DATE(YEAR(D15),MONTH(D15)+{-1,-3},DAY(D15)*{0,1}))

My question is that I don't understand the Min and {} brackets???  How
exactly does this work...I'd like to understand it better!

~Jess
Bob Phillips - 16 Jun 2006 21:44 GMT
Your formula is actually wrong it should be

=MIN(DATE(YEAR(D15),MONTH(D15)+{-2,-3},DAY(D15)*{0,1}))

and it subtracts 3 months not 2.

What is doing is effectively to do two calculations, one for the same day
and 3 months off, and one for the 0th day of 2 months off. The thing is that
if you take 3 months off of say May 31st, it gives you the 31st day of Feb,
which Excel 'smartly' translates to 3rd March. The other calculation, the
0th day of 2 months off gives the 0th day of March, which again, Excel
'smartly' translates to the last day of the previous month, 28th Feb in the
example. The MIN then takes the lower of these two dates to ensure that
months with different number of days are catered for.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

> Hi,
>
[quoted text clipped - 8 lines]
>
> ~Jess
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.