Would you like a date?

If you use dynamic dates and would like for the dates to not show excessive characters then try the below formula, just replace [start date], and [end date] with the fields that contain the start and end date…..
 
=IF(AND(DAY([Start date])=DAY([End date]),MONTH([Start date])=MONTH([End date]),YEAR([Start date])=YEAR([End date])),TEXT([Start date],"D Mmmm YYYY"),IF(AND(MONTH([Start date])=MONTH([End date]),YEAR([Start date])=YEAR([End date])),TEXT([Start date],"D")&" - "&TEXT([End date],"D Mmmm YYYY"),IF(AND(YEAR([Start date])=YEAR([End date])),TEXT([Start date],"D Mmmm")&" - "&TEXT([End date],"D Mmmm YYYY"),TEXT([Start date],"D Mmmm YYYY")&" - "&TEXT([End date],"D Mmmm YYYY"))))

Examples and what will happen…
  1.  5 March 2010 – 5 March 2010
    •  Will equal…. “5 March 2010”
  2.  5 March 2010 – 6 March 2010
    • Will equal…. “5 – 6 March 2010”
  3.  5 March 2010 – 6 April 2010
    •  Will equal… “5 March – 6 April 2010”
  4.  5 March 2010 – 6 April 2011
    •  Will equal… “5 March 2010 – 6 April 2011” (What were you expecting the Easter bunny!! :-) )
If you know a better way why not let me know and we can create useful code for all.

Comments

Popular posts from this blog

Just checking in....

To err is human...

Dashboard style report - How to create a list?