Hi, can you help me by providing user defined minimum value function from a range of values, without using Excel min formula in vba
Hi, can you help me by providing user defined minimum value function from a range of values, without using Excel min formula in vba
You might have to be more specific - not sure why you wouldn't just use Min? There are various ways to do this mainly various different types of sort. A bubblesort springs to mind but that is long and difficult.
Please consider adding a * if I helped.
Hi Brendan
Why I am asking specifically is, I was trying to write other custom function like sum, count if and others normally, and hot stuck on this function for a range of cells more than 2.
Will you hel me giving simple code/idea how can I get minimum value from a selected range of cells.
Suck the data in to an array then do something like this:
Please Login or Register to view this content.
Hey thanks.
I am not thought of using array. Is the code can be written to loop through each cell in range selected and give min value. I want this code to be simple.
Forgot to mention, If a cell has '0' in a range selected then min value will be 0. So that cell has to be ignored and min Val should be from all cells in range.
You could use this. MinNonZeroValue will accept up to 29 arguments. An argument can be any value or a range or an array.
Please Login or Register to view this content.
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
Hi,
ok, i have written below code to find min value in a range. But i am not getting any results for this function created.
Function Getmin(MinRange As Range)
Dim Counter As Integer
Dim Sminval As Integer
Dim TempMin As Integer
Counter = 1
For Each cell In MinRange
If IsNumeric(cell.Value) = True And IsNull(cell.Value) = False Then
If Sminval < cell.Value Then
TempMin = Sminval
End If
End If
Counter = Counter + 1
Next
Getmin = TempMin
End Function
can you help me in correcting this function code.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks