Maybe
=IF(ISBLANK(D40),"",TODAY())
Probably meets the OP's needs. That is, it certainly corrects the
OP's use of ISBLANK().
But caution: ironically, that does not "leave a cell blank", if by
that the OP means ISBLANK() would return true.
Let me clarify. Suppose A1 contains =if(isblank(B1),"",today()), and
suppose B1 is blank. A1 will __appear__ blank. But if A2 contains
=if(isblank(A1),"",today()), A2 will display TODAY() because A1 is not
"blank" in the sense that Excel uses the term. ("Blank" means empty
-- no formula or value.)
In my example, the following is more robust:
A1: =if(B1="", "", today())
A2: =if(A1="", "", today())
B1="" is true if B1 is empty (no formula or value) and if B1 contains
a null string (""), either the result of a formula like above or ="".
Note, however, that B1="" is __not__ true if B1 contains a string of
blanks (e.g. " "), even though that also appears "blank". For that,
you need:
=if(trim(B1)="", "", today())