That's what my formula does, but if your 2 date cells are not next to each other use a comma to separate the cells in the COUNT function.

=if(count(a1,d1)=2,d1-a1,"")

Some examples:

**Sheet1**
* | A | B | C | D | E |

1 | 4/1/2013 | 4/3/2013 | * | * | 2 |

2 | 4/1/2013 | * | * | * | * |

3 | * | 4/3/2013 | * | * | * |

4 | 4/1/2013 | * | * | 4/12/2013 | 11 |

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:64px;"><col style="width:68px;"><col style="width:64px;"><col style="width:81px;"><col style="width:64px;"></colgroup><tbody>

</tbody>

**Spreadsheet Formulas** |

Cell | Formula | E1 | =IF(COUNT(A1,B1)=2,B1-A1,"") | E2 | =IF(COUNT(A2,B2)=2,B2-A2,"") | E3 | =IF(COUNT(A3,B3)=2,B3-A3,"") | E4 | =IF(COUNT(A4,D4)=2,D4-A4,"") |
<tbody>
</tbody> |

<tbody>

</tbody>

**Excel tables to the web >> ** Excel Jeanie HTML 4
I put the formulas in Column E for my examples but it could just as easily go in Column C.