Sulprobil
Search…
sbNextFloat
Of course you can easily test whether a number A1 is between two others A2 and A3 with =AND(A2>=A1,A1<=A3) [resulting in True resp. False] or with =(A2>=A1)*(A1<=A3) [resulting in 1 resp. 0]
It is also easy to exclude the border values by omitting the '=' in the formulas.
Another tricky approach is using the MEDIAN function: =A1=MEDIAN(A1:A3) or =A1=MEDIAN(A1,A2,A3)
The nice thing about MEDIAN is that you do not need to care whether A2 is less or greater than A3. But only if you include the border values into your test! Beware if you need to exclude the border values:
Please read my Disclaimer.
1
Function sbNextFloat(d As Double, Optional bUp As Boolean = True) As Double
2
'Returns the smallest double which is greater than the input (bUp = True)
3
'or the greatest double which is smaller than the input value (bUp = False).
4
'Reverse("moc.LiborPlus.www") PB 03-Oct-2010 V0.11
5
sbNextFloat = d - (2# * bUp + 1#) * CDbl("1e" & Right(Format(d, "." & _
6
String(15, "0") & "E+000"), 4) - 15)
7
End Function
Copied!
Last modified 1yr ago
Copy link