fred.s...@gmail.com pretended :
> ---
> This email has been checked for viruses by AVG.
>
http://www.avg.com
If I understand what you want correctly try this:
SELECT C1, C2, IIf(IsNull([C1]) Or
IsNull([C2]),3,IIf(InStr([c1],[c2])>0,2,1)) AS Result
FROM myTable
Here is the result of that query
C1 C2 Result
=========== ========== ======
DogCatcher Dog 2
DogCatcher Fred 1
Null Null 3
Null Dog 3
DogCatcher Null 3
Rdub