Bug 144274 - Formula not working for minimum positive number... but works in Excel.
Summary: Formula not working for minimum positive number... but works in Excel.
Status: CLOSED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-02 16:35 UTC by Stephen Mathews
Modified: 2021-09-02 17:15 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Mathews 2021-09-02 16:35:38 UTC
Description:
The following formula does not work in LibreOffice but works in Excel:

To find minimum positive number....
=MIN(IF(A1:A4>0,A1:A4))

Given the following numbers:
-56
23
-9
8

The is a site that discribes this formula in detail:

https://www.extendoffice.com/documents/excel/2974-excel-find-smallest-positive-number.html



Steps to Reproduce:
1. enter the following number is cells A1 to A4
-56
23
-9
8

2. In a neighboring cell enter this formula
=MIN(IF(A1:A4>0,A1:A4))

3.  If you -56 that's wrong.  If you see 8 that's correct.


Actual Results:
-56 that's wrong.  

Expected Results:
8 that's correct.


Reproducible: Always


User Profile Reset: No



Additional Info:
If you -56 that's wrong.  If you see 8 that's correct.
Comment 1 Eike Rathke 2021-09-02 17:09:08 UTC
You forgot to enter the formula as an array formula, close it with Shift+Ctrl+Enter instead of just Enter.
Comment 2 Mike Kaganski 2021-09-02 17:15:22 UTC
This is not a bug.

First of all, you do not describe where exactly you put the formula "In a neighboring cell". However, it's clear that you don't read the article that you cite.

I suppose that you see this:
If you put the formula to B1, you see 0
If you put the formula to B2, you see -56
If you put the formula to B4, you see 0
If you put the formula to B5, you see -56

And these are absolutely correct results for the formula in normal mode, because the first argument of IF is evaluated by intersection. But the article tells about *array formula*, and explicitly tells that you need to press Shift + Ctrl + Enter keys. If you do that in Calc, you will get the same expected result.

See also https://help.libreoffice.org/latest/en-US/text/scalc/01/04060107.html?DbPAR=CALC