I have the following function which, in an Excel cell, is written as =FACING_CHANGE(live, optimal, [override]):
Function FACING_CHANGE(live As Integer, opt As Integer, _
Optional override As Range) As String
If override.Value <> "" And IsNumeric(override.Value) = True Then
opt = override.Value
End If
If live = opt Then
FACING_CHANGE = "SAME " & live
ElseIf live > opt And opt = 0 Then
FACING_CHANGE = "DELETED"
ElseIf live > opt And opt > 0 Then
FACING_CHANGE = "DECREASED"
ElseIf live < opt And live = 0 Then
FACING_CHANGE = "ADDED"
ElseIf live < opt And live > 0 Then
FACING_CHANGE = "INCREASED"
End If
End Function
Which returns a string result. I'm having trouble with the optional override parameter. It's of type range right now because a blank cell returns a 0 if override were an integer, which is valid. I need it as an optional param because in most but not all cases it will be used with the 3rd parameter.
When I insert a breakpoint and step through, the function exits automatically at the first if statement (If override.Value...). Below are some results. Any help would be appreciated!
