Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Worksheet position out of range" when calculating a worksheet #1671

Open
hubaksis opened this issue Nov 7, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@hubaksis
Copy link

hubaksis commented Nov 7, 2024

EPPlus usage

Currently reviewing EPPlus before upgrading our project to the latest EPPlus version and purchasing a commercial license.

Environment

Windows

Epplus version

7.4.2

Spreadsheet application

Excel

Description

The following code throws an exception when attempting to process the attached file:

var filePath = @"[path-to]\Template-v68.xlsx";
using (var package = new ExcelPackage(new FileInfo(filePath)))
{
    var workbook = package.Workbook;
    var worksheet = workbook.Worksheets.FirstOrDefault();
    if (worksheet != null)
    {
        worksheet.Calculate();
    }
}

I’ve reduced the original file to the bare minimum after 3 hours of adjustments, hence version 68 :)

The exception occurs specifically when the following formulas are present on Sheet1:

B2 =VLOOKUP($A2,Sheet2!$A:$B,2,FALSE)
C2 =VLOOKUP($A2,Sheet2!$A:$C,3,FALSE)

If I remove either of these formulas, the calculation completes without issues.

Template-v68.xlsx

@hubaksis hubaksis added the bug Something isn't working label Nov 7, 2024
@swmal
Copy link
Contributor

swmal commented Nov 7, 2024

Thanks, we will have a look at this.

swmal added a commit that referenced this issue Nov 7, 2024
@swmal
Copy link
Contributor

swmal commented Nov 7, 2024

@hubaksis Again thanks for the 3 hours spent on isolating this issue! It is now fixed and will be included in the next version of EPPlus. You can test it via our development nuget feed once PR #1672 has been closed.

JanKallman pushed a commit that referenced this issue Nov 7, 2024
* Fixing problem where the first position of the addresses array had a null value in RpnFormulaExecution

* Added test for #1671
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants