If you love VBA then Sumits code is the winner. You can also enter a user defined function from the function library. Release the Ctrl button type the closing parenthesis in the formula bar and press Enter.
However in a Visual Basic procedure you would specify a Range object to get the same.
To use it in the worksheet. This Argument will consist of a String Value that is predefined. Sub IF_OR_Example1 If End Sub Step 2. To use it in the worksheet.