=IFEqual(value,[test],[default])
Function IfEqual(v As Variant, Optional test As Variant, Optional default As Variant = "")
'Programming by Eslam Abdullah
Dim arr, arr2, c, rw&, col&, x&, y&
On Error Resume Next
arr2 = v
rw = UBound(arr2, 1) - 1: col = UBound(arr2, 2) - 1
ReDim arr(rw, col)
If rw + col = 0 Then c = v: GoTo 1
For Each c In arr2
1: If IsMissing(test) Then
If IsError(c) Then arr(x, y) = default Else arr(x, y) = c
Else
If c = test Then arr(x, y) = default Else arr(x, y) = c
End If
x = IIf(x = rw, 0, x + 1)
y = IIf(x = 0, y + 1, y)
Next c
If Err.Number Then IfEqual = Application.Transpose(arr) Else IfEqual = arr
End Function