ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MINIF function (https://www.excelbanter.com/excel-programming/444661-minif-function.html)

kittronald

MINIF function
 
Is it possible to create a MINIF UDF ?

I'm trying to create a UDF that finds the smallest number in a range
for a given criteria.

=MINIF(range_or_array_constant,criteria)

For example, =MINIF({0,1,2,3},"0") would return 1.

Any ideas ?


- Ronald K.

Javed

MINIF function
 
Pls find the following (The use is linke SUMIF function)

Function MINIF(MyRange As Range, Criteria As String)

'The following line must be on single line
MINIF = Application.Evaluate("=MIN(IF(" & MyRange.Address & Criteria &
"," & MyRange.Address & "))")


End Function

kittronald

MINIF function
 
Javed,

Thanks for the quick reply.

Is it possible to get this to work with an array constant in
addition to a range reference ?

For example, =MINIF({0,1,2,3},0)


- Ronald K.

Javed

MINIF function
 
I am sorry.I Think it is beyond my knowledge.

I susupect it is beyond VBA.Shall be very eager to know if anyway is
there.


All times are GMT +1. The time now is 10:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com