Created attachment 126131 [details] test case as described in the bug description Bug #96915 added the capability to refer to names that are defined in another worksheet and have local scope there with the normal syntax for names, i.e. Sheet!Name. Before that, this notation only worked for names either having local scope in the same worksheet or global names. But what is still missing is for INDIRECT to deal with this situation too. The attached spreadsheet "local-name-test.ods" has a local name "pi_value" in Sheet2, and Sheet1 contains one cell refering to with in the formula =Sheet2!pi_value and another cell with the formula =INDIRECT("Sheet2!pi_value"). In LibreOffice 5.2.0.1 the first cell works, the second gives a #REF! error. I don’t know Calc well enough to be certain that there is no other function that would have to be adapted to deal with references of this kind, so I’d be grateful if whoever gets to work on this bug could give this some thought. Thank you for fixing Bug #96915 and for considering this one.
Reproducible Win10x64 Version: 5.3.0.0.alpha0+ Build ID: 757f221bceb74ccc2af8a9d4de149076280f29fb CPU Threads: 4; OS Version: Windows 6.19; UI Render: default; TinderBox: Win-x86@39, Branch:master, Time: 2016-06-23_23:54:55
** Please read this message in its entirety before responding ** 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 http://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://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
The bug is still present in 6.06rc1. Version: 6.0.6.1 Build ID: 1:6.0.6~rc1-1~bpo9+1 CPU threads: 4; OS: Linux 4.9; UI render: default; VCL: gtk3; Locale: en-GB (en_DE.utf8); Calc: group I don’t see much point in testing for a regression, because before Eike Rathke fixed bug #96915 (also reported by me) regarding the same issue outside INDIRECT, it would have been unthinkable that this would have worked. And ever since that other was fixed, I have been intermittently checking whether it would work – it never did.
The bug is still present in Libreoffice 6.2.0.3 (Arch Linux version number). I am finding it hard to understand that a formula that works outside of INDIRECT works but when given to INDIRECT as a string it does not.
(In reply to sebalis from comment #4) > I am finding it hard to understand that a formula that works outside of > INDIRECT works but when given to INDIRECT as a string it does not. You sure dug into the code and at least tried to understand what's happening there?
Could be suitable for an interesting EasyHack, marking as such. Code pointer: sc/source/core/tool/interpr1.cxx ScInterpreter::ScIndirect() and follow / step through in debugger what's happening there for a sheet local scope name.
> You sure dug into the code and at least tried to understand > what's happening there? No, sorry. I commented from the point of viewer of a user who has worked as a software developer, but not with C++. I did not expect to be able to gain insights in an appropriate amount of time so I’ve never looked at the LibreOffice code. What I did think is that the task is the same – parsing a string into a structure representing the formula, and then executing it – so I really thought that your work on bug bug #96915 (thanks again) would have covered the INDIRECT case immediately.
*** Bug 123790 has been marked as a duplicate of this bug. ***
Eike Rathke committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/075da6f2463c922bcb8c553949756af4e8e103e0 Resolves: tdf#100818 Support sheet-local scoped names in INDIRECT() It will be available in 7.1.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Thank you very much, Eike! There’s a real-world application with an ugly workaround which I will have to update later this year anyway; I look forward to converting it back to using this feature. :-)
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/8c4847fb88059259f17d002c4fd84ef82937c2f3 tdf#100818: sc_ucalc: Add unittest It will be available in 7.1.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Verified in Version: 7.1.0.0.alpha1+ Build ID: 35f7d9a18fa7f559a1427e1b8a0f094f864f945a CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3 Locale: en-US (en_US.UTF-8); UI: en-US Calc: threaded @Eike, thanks for fixing this issue!!
I tested it with a current nightly and it worked. Thanks! I was surprised that the INDIRECT variante doesn’t seem to take the same syntax as a direct formula. With INDIRECT I need to use "Sheet!Name" as I had it in my test file (attached to this bug). The syntax displayed in the direct case seems to have changed since I created my file, it is not Sheet.Name (in my test file, Sheet2.pi_value). The INDIRECT variant will not work with the dot as a separator, only with the exclamation mark it seems. I don’t really mind, but would have thought that one would want to use the same forms.
The sheet name separator INDIRECT() supports depends on the "Reference syntax for string reference" setting under Tools > Options > Calc > Formula, Detailed Calculation Settings, Custom. In your document it is explicitly set to "Excel R1C1" so only the '!' separator is supported. Same would be the case for "Excel A1". "Calc A1" would support only '.' separator, "Calc A1 | Excel A1" would try both, in order. The setting is saved with the document, in .xlsx format to a custom property so it's even preserved there. If a .xlsx document is loaded and the property is not present, i.e. as saved by MS-Excel, then "Excel A1" is assumed, IIRC..
I forgot, if set to "Use formula syntax" it follows the Formula syntax set under Tools > Options > Calc > Formula, Formula Options.
This seems to work for a name for a single cell and not for a name for multiple cells. I took the attached "test case as described in the bug description" local-name-test-1.ods and created a 3x3 matrix J7:M10 in Sheet2. I marked the cells K7:M7 and named them sbereich ("column_range"). I marked the cells J8:J10 and named them zbereich ("row_range"). In Sheet1 - =MATCH(J8;Sheet2.sbereich;0) returns 1 correctly - =ADDRESS(MATCH(I10;Sheet2.zbereich;0);MATCH(J8;Sheet2.sbereich;0)) returns $A$2 correctly - =INDIRECT(ADDRESS(MATCH(I11;Sheet2.zbereich;0);MATCH(J8;Sheet2.sbereich;0))) returns #REF - =MATCH(K8;"Sheet2!sbereich";0) returns Err:504 - =ADDRESS(MATCH(I10;"Sheet2!zbereich";0);MATCH(K8;"Sheet2!sbereich";0)) returns Err:504 - =INDIRECT(ADDRESS(MATCH(I11;"Sheet2!zbereich";0);MATCH(K8;"Sheet2!sbereich";0))) returns Err:504 Please see attached local-name-test-2.ods.
Created attachment 175223 [details] test case with named areas
The document has its "Reference syntax for string reference" explicitly set to Excel R1C1 (under Tools - Options - Calc - Formula, Detailed Calculation Settings, Custom, Details. But the ADDRESS() function in J10 and J11 produces A1 style syntax ($A$2 and $A$3). INTERPRET() uses the string reference setting, that can't work and hence the #REF! error. Either set the string reference setting to any of the A1 syntax (depending on what else your document uses), or explicitly force ADDRESS() to produce R1C1 syntax, and best then also tell INDIRECT() to use that, so: =INDIRECT(ADDRESS(MATCH(I11;Sheet2.zbereich;0);MATCH(J8;Sheet2.sbereich;0);1;0);0) For the Err:504 in K9:K11, all these pass a string as second argument to the MATCH() function. That can't work. It must be a cell range reference instead.