If you want to subtract time in Excel, it helps to understand the way that Excel stores times.
Times are stored as positive decimal values in Excel. It is only the formatting of an Excel cell that causes its contents to be displayed as a time, rather than a decimal.
The table below shows examples of decimals and the times that they represent in Excel.
decimal 
equivalent time (hh:mm) 

0  00:00 
0.25  06:00 
0.5  12:00 
0.75  18:00 
1.0  24:00 
1.25  30:00 
1.5  36:00 
As times are stored as simple decimal values, you can subtract time in Excel in the same way that you can subtract any other numbers. Therefore, to subtract time in Excel:
Format the result as a time.
(The easiest way to format a worksheet cell to display a time is to select the cell and then select the 'Time' format from the dropdown menu in the Home tab of the Excel ribbon).
Column C of the following spreadsheet shows four simple Excel time subtraction formulas.
In each case, the time in column A is subtracted from the time in column B.
Formulas:

Results:

Note that, in the results spreadsheet above, cells C2 and C3 are formatted with the time format hh:mm and cells C4 and C5 use the time format hh:mm:ss.
If you have a cell containing a positive decimal value, this can be diplayed as a time, by formatting the cell with a time format.
The easiest way to do this is to select the Time formatting from the dropdown format menu, which is generally located in the 'Number' group, on the Home tab of the Excel ribbon (see below):
If you want to use a different time format, select More Number Formats ... from the dropdown format menu to open up the 'Format Cells' dialog box. Within this dialog box, you can select one of several preprogrammed Time formats or define your own Custom format.
See the Excel Number Formatting page for more information on how to define custom time formats in Excel.