How can I use IF null for a date field in a formula?

How can I use IF null for a date field in a formula?

I have the following calculation in a formula field:

40-((Datecomp(${Matching.Due Date},Now()))/10080)

Can someone help me to modify it so that the formula only calculates when ${Matching.Due Date} is NOT empty and ${Matching.Delivery Date} IS empty? They are both date fields.

Thanks.