Did you see the code Fluff posted in Message #7 yet? And if XL2019 has the MINIFS function, Peter's code in Message #8?very good short and precise solutionRich (BB code):Sub Test() MsgBox Evaluate("MIN(" & Replace(Application.Trim(Replace(" " & Join(Evaluate("TRANSPOSE(A1:A100)")) & " ", " 0 ", " ")), " ", ",") & ")") End Sub
For typed characters, yes but for processes/time no.
This has a few more characters but nearly twice as fast for me.
VBA Code:Sub Test5() MsgBox = Evaluate("minifs(a1:a100,a1:a100,""<>0"")") End Sub
Evaluate("min(if(d33:m33,d33:m33,""<>0""))")
Did you see the code Fluff posted in Message #7 yet?
Sub Test4()
MsgBox [min(if(a1:a100<>0,a1:a100))]
End Sub
And if XL2019 has the MINIFS function, Peter's code in Message #8?
Sub Test5()
MsgBox = Evaluate("minifs(a1:a100,a1:a100,""<>0"")")
End Sub
Evaluate("min(if(a1:a100,a1:a100,""<>0""))")
It shouldn't need that change as MINIFS is a valid function in Excel 2019 according to Microsoft's help on this function.An small change needed the sentence to work :
The parenthesis between the MIN and the IF was missing and the letter "s" had to be removed after the IF
It shouldn't need that change as MINIFS is a valid function in Excel 2019 according to Microsoft's help on this function.
The code certainly worked for me as I posted it.
However, if you have something that you are happy with, that is fine.
View attachment 12765
Yes but really No. I originally had a variable equal to the evaluate part of that code and viewed the result. However, to post the code I decided to go straight to the MsgBox and forgot to remove the "=" sign and must not have tested, sorry.Have you run the code with function MINIFS?
Sub Test5()
MsgBox Evaluate("minifs(a1:a100,a1:a100,""<>0"")")
End Sub
Yes but really No. I originally had a variable equal to the evaluate part of that code and viewed the result. However, to post the code I decided to go straight to the MsgBox and forgot to remove the "=" sign and must not have tested, sorry.
Just remove that "=" sign and try again. (I have tested this time. )
VBA Code:Sub Test5() MsgBox Evaluate("minifs(a1:a100,a1:a100,""<>0"")") End Sub
x=Evaluate("minifs(a1:a100,a1:a100,""<>0"")")
MsgBox Evaluate("minifs(a1:a100,a1:a100,""<>0"")")
x=Evaluate("min(if(a1:a100,a1:a100,""<>0""))")
MsgBox Evaluate("min(if(a1:a100,a1:a100,""<>0""))")
Yes but really No. I originally had a variable equal to the evaluate part of that code and viewed the result. However, to post the code I decided to go straight to the MsgBox and forgot to remove the "=" sign and must not have tested, sorry.
Just remove that "=" sign and try again. (I have tested this time. )
VBA Code:Sub Test5() MsgBox Evaluate("minifs(a1:a100,a1:a100,""<>0"")") End Sub
Pleased to see that it wasn't only me making errors in this thread.Sorry, I had tested it on another pc with XL2016 and that was the reason why it didn't work.