Created attachment 30413 [details] testcase WeekNumFunctionTestCaseData.xls Returns a number that indicates where the week falls numerically within a year. patch for missing function WEEKNUM WEEKNUM function is part of Analysis ToolPak add-in. Testcases in WeekNumFunctionTestCaseData.xls Written for Java 1.5
Created attachment 30414 [details] patch for missing function WEEKNUM
Created attachment 30453 [details] Add additional sanity check/integration test FormulaEvalTestData.xls
Note that WEEKNUM is a built-in function (not part of the analysis tookpak) for Excel 2010/2011 and Excel 2013 (and possibly Excel 2007/2008)
(In reply to Niggler from comment #3) > Note that WEEKNUM is a built-in function (not part of the analysis tookpak) > for Excel 2010/2011 and Excel 2013 (and possibly Excel 2007/2008) That could be fun. Any chance someone could create a simple spreadsheet with Excel 2003, and another with 2013 (both need to be fresh files), both of which make a single use of WEEKNUM? That'll let us confirm if they both write it the same even with the analysis tookpak change
Patch committed r1530256 Now assert validity of weeknum implemntation with 2 simple spreadsheet (Excel 2003, and another with 2013 - both are fresh files), both of which make a single use of WEEKNUM
Please note that implementation is incomplete as it does not handle the default return value for the function. The function works fine if it has 2 arguments (the last being the return type) but fails if the user just use WEEKNUM(cell) and omits the second argument for the return type. Regards Dmitry Vasilenko
Update summary to reflect current state of this bug
Documentation: https://support.office.com/en-us/article/WEEKNUM-function-E5C43A03-B4AB-426C-B411-B18C13C75340
Created attachment 34776 [details] Patch adding the 1-argument version of WeekNum This patch is untested. The unit test coverage for WeekNum is currently in Excel files. test-data/spreadsheet/WeekNumFunctionTestCaseData*.xls
WEEKNUM support was inproved for POI 5.1.0 - https://bz.apache.org/bugzilla/show_bug.cgi?id=65606