Bug 155424

Summary: LISTIF function
Product: LibreOffice Reporter: Liam M <liammcgillivray32>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: UNCONFIRMED ---    
Severity: enhancement CC: 79045_79045, erack, miguelangelrv, winfrieddonkers, xiscofauli
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 108827    

Description Liam M 2023-05-20 18:52:34 UTC
Description:
I propose a new function called "LISTIF" for Libreoffice Calc. This function finds the nth value in a range that meets the stated criterion.

It would have the following arguments:
Range: The range to be evaluated by the criteria given.
Criteria: The criterion to be applied to the range.
Number: The nth value that meets the criterion will be displayed.
List range (optional): The range from which outputs will be drawn.

If the "number" argument is set to "1", then this function will output the first value in the range that meets the criteria. If set to "2", it will output the second.

Actual Results:
 

Expected Results:
 


Reproducible: Always


User Profile Reset: No

Additional Info:
Comment 1 m_a_riosv 2023-05-20 23:35:00 UTC
You can do it easily with AGGREGATE function, or with LARGE as array.
1	8	=AGGREGATE(14;4;A:A*(A:A<15);2)
2		
3	8	{=LARGE(A:A*(A:A<15);2)}
4	
5		
6		
1		
3		
5		
17		
21		
4		
8		
12			

AGGREGATE help :https://help.libreoffice.org/7.6/en-US/text/scalc/01/func_aggregate.html?DbPAR=CALC#bm_id126123001625791
LARGE help https://help.libreoffice.org/7.6/en-US/text/scalc/01/04060183.html?DbPAR=CALC#bm_id3149530

Being possible to get it only with one function, I don't think will be easy to get it developed.
Comment 2 Xisco FaulĂ­ 2023-05-22 09:48:10 UTC
@Winfried, @Eike, any opinion on this ?