WEEKS Function (LibreOffice Calc)

Date & Time Intermediate LibreOffice Calc Introduced in LibreOffice 3.5
date week-difference intervals scheduling reporting project-management

The WEEKS function returns the number of whole weeks between two dates. It is essential for scheduling, reporting, HR calculations, project management, and any workflow requiring week-based intervals.

Compatibility

What the WEEKS Function Does

  • Returns the whole number of weeks between two dates
  • Accepts dates, datetimes, and serial numbers
  • Can return positive or negative values
  • Ignores partial weeks unless mode = 1

It is designed to be simple, predictable, and ideal for week‑interval calculations.

Syntax

WEEKS(start_date; end_date; [mode])

Arguments

  • start_date:
    The beginning date.

  • end_date:
    The ending date.

  • mode (optional):

    • 0 (default): Count whole weeks only
    • 1: Count partial weeks as whole weeks (ceiling behavior)

Basic Examples

Whole weeks between two dates

=WEEKS("2024-01-01"; "2024-02-01")

Returns 4.

Weeks between dates with partial week ignored

=WEEKS("2024-01-10"; "2024-02-01")

Returns 3.

Weeks between dates counting partial weeks

=WEEKS("2024-01-10"; "2024-02-01"; 1)

Returns 4.

Using cell references

=WEEKS(A1; B1)

Advanced Examples

Weeks between today and a deadline

=WEEKS(TODAY(); A1)

Weeks between two text dates

=WEEKS(DATEVALUE(A1); DATEVALUE(B1))

Weeks between imported CSV timestamps

=WEEKS(DATEVALUE(LEFT(A1;10)); DATEVALUE(LEFT(B1;10)))

Weeks between Excel serial dates stored as text

=WEEKS(DATE(1899;12;30)+VALUE(A1); DATE(1899;12;30)+VALUE(B1))

Determine if two dates fall in the same week (7‑day block)

=WEEKS(A1; B1) = 0

Calculate weekly billing cycles

=BaseRate * WEEKS(StartDate; EndDate)

Calculate age in weeks

=WEEKS(A1; TODAY())

Weeks remaining in the year

=WEEKS(TODAY(); DATE(YEAR(TODAY());12;31))

Edge Cases and Behavior Details

WEEKS returns an integer

Accepts:

  • Real dates
  • Serial numbers
  • DATEVALUE outputs
  • ISO date strings

Invalid text → Err:502

Behavior details

  • Partial weeks ignored unless mode = 1
  • Negative results allowed
  • Time components ignored
  • Date order does not matter (Calc swaps automatically)

WEEKS of an error → error propagates

Common Errors and Fixes

Err:502 — Invalid argument

Cause:

  • Text not recognized as a date
  • Non-numeric values
  • Wrong separators

Fix:

  • Wrap with DATEVALUE
  • Clean text with TRIM or SUBSTITUTE

Wrong week count due to partial week

Fix:

  • Use mode = 1 to count partial weeks

Unexpected result from serial numbers

Cause:

  • Imported values represent days since epoch

Fix:

  • Convert with DATE(1899;12;30)+VALUE(A1)

Best Practices

  • Use WEEKS for scheduling, reporting, and project timelines
  • Normalize text dates with DATEVALUE
  • Use mode = 1 when partial weeks should count
  • Use WEEKS with NETWORKDAYS for business‑day logic
  • Use WEEKS for weekly reporting periods
WEEKS is your week‑interval engine — perfect for scheduling, reporting, HR logic, and any workflow where week‑based differences matter.

Related Patterns and Alternatives

  • Use DAYS for day intervals
  • Use MONTHS for month intervals
  • Use YEARS for year intervals
  • Use DATEDIF for flexible interval logic
  • Use WEEKNUM or ISOWEEKNUM for week numbering
  • Use DATEVALUE for text conversion

By mastering WEEKS and its companion functions, you can build powerful, reliable, and fully structured week‑interval workflows in LibreOffice Calc.

Copyright 2026. All rights reserved.