Bug 157421 - SUMIF() seems broken for A) single-cells/single-cell ranges and B) non-matching non-trivial range criteria
Summary: SUMIF() seems broken for A) single-cells/single-cell ranges and B) non-matchi...
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.5.6.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-25 00:51 UTC by mjk_bdo
Modified: 2023-09-25 01:34 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Spreadsheet with 2 sheets, demonstrating SUMIF bug(s) (15.87 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-09-25 00:53 UTC, mjk_bdo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mjk_bdo 2023-09-25 00:51:25 UTC
Description:
Motivation
----------
I have 2 columns:
- A contains a list of numbers (with empty cells in between).
- B contains the sum of all numbers in A up to and including the current row.

The formula for column B is easily created using the SUM() function. However, when the cell in column A in the same row is empty, I need the B-cell to be empty or show 0.

Thusly, I rewrote the simple SUM() formula using SUMIF(), like so:

  =SUMIF($Ax,"<>",$A$1:$Ax)

where x is the current row.


BUG
---
Alas, every way of employing SUMIF() gives wrong results, i.e. the results differ from what I expect after reading

  https://wiki.documentfoundation.org/Documentation/Calc_Functions/SUMIF

For demonstration purposes, I attached an ODS file with 2 sheets: Sheet 1 is close to the original use case, in Sheet 2, SUMIF() has a <SumRange> parameter.

I hope I have not misinterpreted the documentation. If so, I might file a documentation bug. ;-)


Steps to Reproduce:
See attached file.

Actual Results:
See attached file.

Expected Results:
See attached file.


Reproducible: Always


User Profile Reset: No

Additional Info:
I am using Libreoffice 7.5.6.2 in Devuan (current stable, "Daedalus", based on Debian 12), but I am confident that this is not a Devuan specific bug.
Comment 1 mjk_bdo 2023-09-25 00:53:14 UTC
Created attachment 189802 [details]
Spreadsheet with 2 sheets, demonstrating SUMIF bug(s)
Comment 2 ady 2023-09-25 01:34:32 UTC
(In reply to mjk_bdo from comment #0)
> I hope I have not misinterpreted the documentation. If so, I might file a
> documentation bug. ;-)

There is no documentation bug, but (unfortunately) you have misinterpreted several points of the documentation of the SUMIF() function.

This site is for bug reports and enhancements requests only, not for user support. I would kindly suggest you to reach out to other users, for example by the users mailing list, or at https://ask.libreoffice.org . Generally speaking, using first those methods to review potential problems and receive feedback before filing a bug report would be a good practice.

I am now setting this report as invalid.