Is it possible to use cell references in an IF function's logical test?

Like:

C1: M2=""
D1: O2

if(c1;d1;1)

Because if I use it that way then the expression is used as a text ("M2=""") hence it doesn't work.