MINBETWEEN
MINBETWEEN(rgeValues, minValue, maxValue, bInclusive)
Returns the smallest value that is between a range.
| rgeValues | |
| minValue | |
| maxValue | |
| bInclusive |
REMARKS
Similar to the user defined functions COUNTBETWEEN, MAXBETWEEN, SUMBETWEEN and ISBETWEEN
Public Function MIN_BETWEEN( _
rng As Range, _
lowerBound As Double, _
upperBound As Double) _
As Variant
Dim cell As Range
Dim smallest As Double
Dim found As Boolean
found = False
For Each cell In rng.Cells
If IsNumeric(cell.Value) Then
If cell.Value >= lowerBound And cell.Value <= upperBound Then
If Not found Then
smallest = cell.Value
found = True
Else
If (cell.Value < smallest) Then
smallest = cell.Value
End If
End If
End If
End If
Next cell
If (found = True) Then
MIN_BETWEEN = smallest
Else
MIN_BETWEEN = CVErr(xlErrNA) ' No matching value found
End If
End Function
For instructions on how to add this function to a workbook refer to the page under Inserting Functions
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext