Bug 156766 - Complex formula with WEEKNUM result restarts after 31st week of year
Summary: Complex formula with WEEKNUM result restarts after 31st week of year
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.6.0.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Cell-Formula
  Show dependency treegraph
 
Reported: 2023-08-14 11:12 UTC by Gabor Kelemen (allotropia)
Modified: 2025-08-14 03:12 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Example file from LO master (27.35 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-08-14 11:12 UTC, Gabor Kelemen (allotropia)
Details
How the example file looks in master (120.16 KB, image/png)
2023-08-14 11:16 UTC, Gabor Kelemen (allotropia)
Details
How the example file looks in Excel 2016 and master (137.96 KB, image/png)
2023-08-14 11:17 UTC, Gabor Kelemen (allotropia)
Details
quick fixed Formulas in the Weeknumber-Columns (25.75 KB, application/octet-stream)
2023-08-14 12:24 UTC, Werner Tietz
Details
shows the bad formatting on output from WEEKNUM(…) (18.37 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-08-14 13:56 UTC, Werner Tietz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2023-08-14 11:12:57 UTC
Created attachment 188964 [details]
Example file from LO master

Attached user made (saved as ods from an Excel file by LO) file contains some complex formula, mainly building on the WEEKNUM function.
The expectation is that in every fifth column the number of the week is calculated next to the Monday cell of a week.
This works fine until the formula result is not greater than 31, but after that it restarts at 1 instead of continuing with 32... until 52.

1. Open attached file
2. Notice the calculated week numbers in column AC of the first sheet
-> In AC17 the result is 1 instead of 32

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 218a7650a5cf03f895bed19c68d6f02daec536e9
CPU threads: 15; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded

and back until 3.6. In 3.5 however the numbering did not restart, although it did not give the same results as today either - calculated results were larger by 1.
Which interestingly is pretty similar how Excel 2016 calculates using the same ods file.

Bibisect with linux-4.3all got this range, but nothing sticks out to me:

https://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=73202f8edc074ec035255d25ff29bfd4a8d8dfd6..6b11a18071254a443c8fe7e7b0b1c95b0f9fd35e
Comment 1 Gabor Kelemen (allotropia) 2023-08-14 11:16:35 UTC
Created attachment 188965 [details]
How the example file looks in master
Comment 2 Gabor Kelemen (allotropia) 2023-08-14 11:17:15 UTC
Created attachment 188966 [details]
How the example file looks in Excel 2016 and master
Comment 3 Julien Nabet 2023-08-14 11:48:56 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.
Comment 4 Werner Tietz 2023-08-14 12:10:22 UTC
this is Error by User with stupid **TT.** Format in the Style of Conditional Format.
This stupid Document needs a complete rework!

NOTABUG
Comment 5 Werner Tietz 2023-08-14 12:24:29 UTC
Created attachment 188969 [details]
quick fixed Formulas in the Weeknumber-Columns
Comment 6 Werner Tietz 2023-08-14 13:56:29 UTC
Created attachment 188971 [details]
shows the bad formatting on output from WEEKNUM(…)
Comment 7 QA Administrators 2025-08-14 03:12:53 UTC
Dear Gabor Kelemen (allotropia),

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug