Bug 161496 - Names defined in LET() cannot be used for ranges in INDEX()
Summary: Names defined in LET() cannot be used for ranges in INDEX()
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
24.8.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Balázs Varga (allotropia)
URL:
Whiteboard: target:24.8.0
Keywords:
Depends on:
Blocks: Excel-Functions
  Show dependency treegraph
 
Reported: 2024-06-10 14:45 UTC by Jürgen Kirsten
Modified: 2024-06-11 10:35 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Sample document (12.70 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-06-10 14:50 UTC, Jürgen Kirsten
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jürgen Kirsten 2024-06-10 14:45:56 UTC
Description:
If you try to connect areas with each other using INDEX(), you will receive an error when using names defined in LET().

Steps to Reproduce:
With the INDEX function, I can use the following formula =INDEX((A2:A4~C2:C4~E2:E4),MOD(SEQUENCE(9,1,0),3)+1,0,INT(SEQUENCE(9,1,0)/3)+1) to create a matrix that writes all three ranges one below the other. First the range 1 then 2 and then 3. 
The ranges are connected in Index with the tilde.

If you now try to define these three ranges in advance and assign them to a name with LET(), this no longer works with the names in INDEX().

=LET(a,A2:A4,b,C2:C4,c,E2:E4,INDEX((a~b~c),MOD(SEQUENCE(9,1,0),3)+1,0,INT(SEQUENCE(9,1,0)/3)+1)) results in Error 502.

In Excel, this also works with the names defined in LET().
In Excel there is the function VSTACK() which performs the same task.  

Actual Results:
Error 502

Expected Results:
my three ranges


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.8.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 6d39b1a6068bbbd5ca4947f668f989dbfb73342d
CPU threads: 8; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Vulkan; VCL: win
Locale: en-GB (de_DE); UI: en-GB
Calc: threaded
Comment 1 Jürgen Kirsten 2024-06-10 14:50:45 UTC
Created attachment 194632 [details]
Sample document

The bug can be seen in this document
Comment 2 ady 2024-06-10 15:52:10 UTC
FWIW, Error 502 means "IllegalArgument", Invalid argument.
Comment 3 Commit Notification 2024-06-11 10:24:49 UTC
Balazs Varga committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5c9040c16506d5ef2708416ea280d97b707092b4

tdf#161496 - Fix single ocPush tokens in LET function Name values

It will be available in 24.8.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.