Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jessica
 
Posts: n/a
Default DATE function clarification

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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default DATE function clarification

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)

"Jessica" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
date function [email protected] Excel Discussion (Misc queries) 3 March 22nd 06 12:16 PM
Date formula and if function alane Excel Worksheet Functions 4 January 28th 06 01:11 AM
Date function in Excel that updates only when a doc is changed? torino0020 Excel Worksheet Functions 1 January 5th 06 03:00 AM
Date Function Khangura Excel Discussion (Misc queries) 1 December 21st 05 09:33 AM
date format and the RIGHT function Rich Hayes Excel Worksheet Functions 0 December 19th 05 11:06 AM


All times are GMT +1. The time now is 01:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"