Hello,
I’m using Aspose.Cells for .NET. I’m experiencing very strange behavior when using SWITCH statement in the Array Formula after upgrading to the latest version 23.2.0 (from version 22.1.0) several days ago.
In the following formulas, SOURCE_DATA is a named range. What I’m trying to do is attach a tag like (4) behind the string if the playname equals to ExpressShow, or (10) if there is no matching found.
Expected result:
BroadwayShow(10)
ExpressShow(4)
ImmersiveShow(10)
The following query only has the first row populated when I output as pdf:
=INDEX(OFFSET(SOURCE_DATA,1,0,ROWS(SOURCE_DATA)-1,COLUMNS(SOURCE_DATA)),MATCH(“playname”,INDEX(SOURCE_DATA,1,0),0))&SWITCH(INDEX(OFFSET(SOURCE_DATA,1,0,ROWS(SOURCE_DATA)-1,COLUMNS(SOURCE_DATA)),MATCH(“playname”,INDEX(SOURCE_DATA,1,0),0)),“ExpressShow”,"(4)","(10)")
Result:
BroadwayShow(10)
if I took off the default value, then all cells covered by the whole array formula could be populated, but the “(4)” is NOT attached to ExpressShow.
=INDEX(OFFSET(SOURCE_DATA,1,0,ROWS(SOURCE_DATA)-1,COLUMNS(SOURCE_DATA)),MATCH(“playname”,INDEX(SOURCE_DATA,1,0),0))&SWITCH(INDEX(OFFSET(SOURCE_DATA,1,0,ROWS(SOURCE_DATA)-1,COLUMNS(SOURCE_DATA)),MATCH(“playname”,INDEX(SOURCE_DATA,1,0),0)),“ExpressShow”,"(4)","")
Result
BroadwayShow
ExpressShow
ImmersiveShow
Everything is working as expected if I change from SWITCH to IF:
=INDEX(OFFSET(SOURCE_DATA,1,0,ROWS(SOURCE_DATA)-1,COLUMNS(SOURCE_DATA)),MATCH(“playname”,INDEX(SOURCE_DATA,1,0),0))&if(INDEX(OFFSET(SOURCE_DATA,1,0,ROWS(SOURCE_DATA)-1,COLUMNS(SOURCE_DATA)),MATCH(“playname”,INDEX(SOURCE_DATA,1,0),0))=“ExpressShow”,"(4)","")
I debugged into the code and found that after wb.RefreshDynamicArrayFormulas()
, the calculatedresult only contains the show’s name like ExpressShow
and doesn’t have <sup>(4)</sup>
attached.
So I suspect the behavior of SWITCH statement is changed. Could you please advise if anything is changed?
Thank you,