Documentation/How Tos/Calc: WEEKS function

From Apache OpenOffice Wiki
< Documentation‎ | How Tos
Revision as of 21:33, 17 February 2008 by Drking (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


WEEKS

Returns the number of weeks between two dates.

This function is only available if the Analysis AddIn is installed.

Syntax:

WEEKS(startdate; enddate; mode)

If mode is 0, WEEKS returns the number of whole weeks between startdate and enddate - that is INT(number_of_days_difference / 7).
If mode is 1, WEEKS identifies the Monday_to_Sunday week that startdate and enddate each lie in, and returns the difference between those weeks.
If startdate is after enddate the result will be negative.

Example:

WEEKS("2010-05-03"; "2010-05-17"; 0)

returns 2. Both dates are Mondays, and there are 14 days between them.

WEEKS("2010-05-04"; "2010-05-27"; 0)

returns 3; there are 23 days between the two dates.

WEEKS("2010-05-06"; "2010-05-17"; 1)

returns 2; 6 May 2010 lies in week 3-9 May, and 17 May 2010 lies in week 17-23 May, two weeks later.

WEEKS("2010-05-09"; "2010-05-10"; 1)

returns 1. 9 May 2010 is a Sunday and 10 May 2010 is the Monday of the following week.


See also:

DAYS, MONTHS, YEARS

Date & Time functions

Date & Time overview

Personal tools