-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
COUNTIFS Formula has a prefix in Excel =_xlfn.countifs #3819
Comments
I am not sure what your issue is. Starting with Excel 2010, Microsoft decided that new functions required prefix So, if you are just asking for an explanation, that's it. However, if you are having a problem because of this, possibly due to your different locale, please give more details on what the problem is. Supplementary note - I believe our classification that COUNTIFS was introduced with 2019 was incorrect, and that it was available with 2007 and doesn't need a prefix; however the addition of xlfn would still be required for many other functions, e.g. MAXIFS. I will look into removing COUNTIFS from our list. |
It was on our list as "introduced in 2019". It was, in fact, available with Excel 2007 (https://support.microsoft.com/en-us/office/excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188#bm3), so does not require a prefix when writing it to a spreadsheet. Brought to my attention with issue PHPOffice#3819, although I'm not sure correcting this will entirely solve the user's problem.
Fix PHPOffice#3819. Excel can add these prefixes (basically invisible to end-user). Formula translation in PhpSpreadsheet fails when dealing with these unexpected prefixes, and, even if it handled it correctly, the unexpected prefixes confuse the users. I have changed to strip those prefixes when translating to a locale. This is probably not perfect, but is almost certainly good enough. I could easily add the same change when translating from a locale to English, but I don't think there's a good use case for that, so am opting not to do so for now. The documentation mentions `translateFormulaToLocale` and `translateFormulaToEnglish`. Neither of these exist; both names are preceded by an underscore. I have changed the code to match the documentation rather than vice versa, retaining deprecated versions of the underscored routines which merely invoke the non-underscored routines.
This is:
What is the expected behavior?
Create with PHP the formula:
$oWorkSheet->getCell([7, $iRow])->setValue("=COUNTIFS('XX'!K:K,A" . $iRow . ",'XX'!C:C,G3)");
What is the current behavior?
Formula in Excel =_xlfn.countifs($XX.K:K;A4;$XX.C:C;G3)
For COUNTIF - it replaced to ZÄHLENWENN (Germany)
What are the steps to reproduce?
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
The text was updated successfully, but these errors were encountered: