EPPlus icon indicating copy to clipboard operation
EPPlus copied to clipboard

Array formula with MATCH and IF gives incorrect results

Open abrguyt opened this issue 6 years ago • 4 comments

(see text in next post)

abrguyt avatar Jun 14 '19 02:06 abrguyt

Using the array formula: {=MATCH(B3, IF(TRUE, B5:B8))} gives incorrect index results, assuming B3 contains the lookup key value, and the B5:B8 range the values in which to lookup the key. The result using EPPlus v. 4.5.3.1 seems to be always 1, instead of the actual row index for the matching value in the lookup range.

Using Match without the array formula mode gives the correct index, so maybe the problem is in the IF function not being able to work correctly in array mode.

Please find attached the .xlsx file; reading the value of B2 using EPPlus will yield the incorrect value (1), while Excel gives (3) as correct value. epplus test arrayformula.xlsx

abrguyt avatar Jun 14 '19 02:06 abrguyt

Hi @abrguyt,

The formula calc engine in EPPlus does not yet support array formulas. We plan to implement it in EPPlus 5. It is mentioned at the bottom of this wiki page, but I do understand if you haven't seen it. We will make it clearer in future documentation.

/Mats

swmal avatar Feb 10 '20 19:02 swmal

Hi @swmal,

Thanks for letting me know - I hadn't seen that on the wiki page indeed. Now looking forward to the version 5 release !! :-) That will be a great leap forward.

abrguyt avatar Feb 11 '20 00:02 abrguyt

Many thanks, just to set the expectations straight - it will not be in the initial EPPlus 5 release, but when we have stabilized the new version array formulas are one of the things we will start implementing.

swmal avatar Feb 11 '20 21:02 swmal