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: 2023-08-14 13:56 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(…)