Example

sbNextFloat

Appendix sbNextFloat Code

Please read my Disclaimer.

Option Explicit

Function sbNextFloat(d As Double, Optional bUp As Boolean = True) As Double
'Returns the smallest double which is greater than the input (bUp = True)
'or the greatest double which is smaller than the input value (bUp = False).
'Source (EN): http://www.sulprobil.com/sbnextfloat_en/
'Source (DE): http://www.bplumhoff.de/sbnextfloat_de/
'(C) (P) by Bernd Plumhoff 03-Oct-2010 PB V0.11
sbNextFloat = d - (2# * bUp + 1#) * CDbl("1e" & Right(Format(d, "." & _
              String(15, "0") & "E+000"), 4) - 15)
End Function

Download

Please read my Disclaimer.

sbNextFloat.xlsm [17 KB Excel file, open and use at your own risk]