Custom Functions

A

allancole44

Want to use and mix multiple AND and OR in condition
statement in Custom Function.

Format as "If Condition1 and Condition2 and etc.

Does not work.

Assistance requested.

Thanks
 
T

Tod

If you are speaking of VBA code, you would use AND and OR
like this:

Dim MyName as String

MyName = "tod"

If MyName = "tod" and MyName <> "Fred" Then
'code
End If

IF MyName = "tod" or MyName = "Fred" Then
'code
End If



If you are using a formula:

=If(And(A1="tod",B1<>"Fred"),True,False)

=If(Or(A1="tod",A1="Fred"),True,False)

tod
 
D

David McRitchie

and in VBA those examples would be case sensitive
and the Worksheet Function examples would be case insensitive.
 
Top