I'm trying to write a VBA function that restricts its inputs. It takes three arguments min
, mode
, and max
, and needs to ensure that min < mode < max
.
Here's what I have so far:
Function TRIANGULAR(min As Double, mode As Double, max As Double)
If min < mode < max Then
TRIANGULAR = (min + mode + max) / 3
Else
MsgBox "min < mode < max", vbCritical
End If
End Function
What am I missing?
If
's don't work like that.
use
If (min < mode) and (mode < max) Then