Bug 163964 - Converting Calc Expression to MS Excel (name > @name) works in formula but not inside another Expression
Summary: Converting Calc Expression to MS Excel (name > @name) works in formula but no...
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-19 19:01 UTC by Gauthier
Modified: 2025-05-07 14:08 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
test file demonstrating issues (6.92 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2024-11-25 13:25 UTC, Gauthier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gauthier 2024-11-19 19:01:54 UTC
In Calc I created some expressions (from menu Sheets > Named Ranges and Expressions) e.g: 
expr1 = A1xA2
expr2 = B2 + expr1

I can use both expressions in the formula bar in calc simply by typing expr1 or expr2 to do some stuff with them.

The file is saved as .xlsx (because sadly I really have to).

When I open it in MS Excel, in the formula bar, any reference to the above expression are correctly converted to @expr1 or @expr2.

@expr1 throws the correct value but @expr2 throw a syntax error #NAME?. 

Looking into those expressions in Excel (Name Manager), the expressions refers to:
expr1 = A1xA2 (showing correct value)
expr2 = B2 + expr1 (showing #NAME? value) - notice that this is exactly the same than in calc, and expr1 is not converted to @expr1 inside expr2.

In there if I modify expr2 to B2 + @expr1 then @expr2 throws the correct value.
Comment 1 Eric Rodriguez 2024-11-23 21:20:47 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
(Note that the attachment will be public, remove any sensitive information before attaching it.
See <https://wiki.documentfoundation.org/QA/FAQ#sanitize> for further detail.)

Please also paste your version information by going to Menu/Help/About Libreoffice use the copy button to copy your version information and paste it here in a response.
Comment 2 Gauthier 2024-11-25 13:25:36 UTC
Created attachment 197774 [details]
test file demonstrating issues

Actually after more test I realised the issue is slightly more complex than how I first reported it in the bug report.

It has in fact to do with inconsistencies when the scope of the expressions are set to one sheet only, instead of global. They work fine in LO but some of them stop working in MS Excel. This is in fact due to the sheet name not being appended to some of the expressions  (strangely not consistent across all), which is how the scope seem to be defined in Excel.

In the attached file, you'll see that in Excel:
expr2 = Sheet1!$B$2+numb >> this does not work
expr3 = Sheet1!$A$3/Sheet1!numb >> this works fine

When going to Excel (Name Manager), just opening the expression that doesn't work and save it again makes it work as Excel then automatically appends sheet name to it (e.g. expr2 become: Sheet1!$B$2+Sheet1!numb).

Version: 24.8.3.2 (X86_64)
Build ID: 480(Build:2)
CPU threads: 12; OS: Linux 6.11; UI render: default; VCL: kf6 (cairo+wayland)
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded

MS Office 2021
Win 11
Comment 3 QA Administrators 2024-11-26 03:15:20 UTC Comment hidden (obsolete)
Comment 4 Buovjaga 2025-05-07 14:08:39 UTC
(In reply to Gauthier from comment #2)
> Created attachment 197774 [details]
> test file demonstrating issues

Can you give steps for how we can reconstruct this from scratch?