Before learning how to subtract dates in Excel, it is important that you first understand how dates are stored within Excel.
Dates are actually stored as positive integers in Excel. It is only the formatting of an Excel cell that causes a number to be displayed as a date, rather than a simple numerical value.
The numbering system used for Excel dates varies with different computer systems, but most commonly, the number 1 represents the date, 01Jan1900, the number 2 represents 02Jan1900, ... , the number 40544 represents 01Jan2011, etc.
Because dates are simply integers, you can subtract dates in Excel, in the same way that you can subtract any other integers, and the result from the subtraction of two dates is the number of days between the two dates.
The following spreadsheet shows three examples of subtracting dates in Excel.
The spreadsheet on the left shows the formulas used and the spreadsheet on the right shows the results.
Formulas:

Results:

Note that, in the results spreadsheet of the above example, the cells in columns A and B are formatted with a date format, but the cells in column C are formatted with the 'General' format.