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

SUMIF formula does not work for horizontal ranges #2320

Open
3 of 6 tasks
Brainman643 opened this issue Apr 2, 2024 · 0 comments
Open
3 of 6 tasks

SUMIF formula does not work for horizontal ranges #2320

Brainman643 opened this issue Apr 2, 2024 · 0 comments

Comments

@Brainman643
Copy link

Read and complete the full issue template

Do not randomly delete sections. They are here for a reason.

Do you want to request a feature or report a bug?

  • Bug
  • Feature
  • Question

Did you test against the latest CI build?

  • Yes
  • No

Version of ClosedXML

0.104.0-preview3

What is the current behavior?

SUMIF formula always returns 0 if horizontal range is passed. E.g SUMIF(A1:D1,300000,A2:D2)

What is the expected behavior or new feature?

SUMIF formula returns correct values for any dimensions.

Is this a regression from the previous version?

No, it's not. I also checked version 0.102.2.

Reproducibility

Code to reproduce problem:

        [TestCase(33, "SUMIF(A1:D1,300000,A2:D2)")]
        public void SumIf_ReturnsCorrectValues_HorizontalRanges(int expectedOutcome, string formula)
        {
            using (var wb = new XLWorkbook())
            {
                wb.ReferenceStyle = XLReferenceStyle.A1;

                var ws = wb.AddWorksheet("Sheet1");

                ws.Cell("A1").Value = 100000;
                ws.Cell("B1").Value = 200000;
                ws.Cell("C1").Value = 300000;
                ws.Cell("D1").Value = 400000;

                ws.Cell("A2").Value = 11;
                ws.Cell("B2").Value = 22;
                ws.Cell("C2").Value = 33;
                ws.Cell("D2").Value = 44;

                Assert.AreEqual(expectedOutcome, ws.Evaluate(formula).GetNumber());
            }
        }
  • I attached a sample spreadsheet. (You can drag files on to this issue)
    wb.xlsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant