Function max(a As Double, b As Double) As Double
Dim i, j, k, l As Integer
k = Sgn(a - b)
l = k * k
i = l * (l + k) / 2
j = l * (l - k) / 2
max = a * i + b * j
End Function
Function min(a As Double, b As Double) As Double
k = Sgn(b - a)
min = a * i + b * j
Excel VBA
Function max(a As Double, b As Double) As Double
Dim i, j, k, l As Integer
k = Sgn(a - b)
l = k * k
i = l * (l + k) / 2
j = l * (l - k) / 2
max = a * i + b * j
End Function
Function min(a As Double, b As Double) As Double
Dim i, j, k, l As Integer
k = Sgn(b - a)
l = k * k
i = l * (l + k) / 2
j = l * (l - k) / 2
min = a * i + b * j
End Function
Excel VBA