You can use the HOUR function in Excel to extract the hour from a datetime.
For example, you can use the following formula to extract the hour from the datetime in cell A2:
The following example shows how to use this formula in practice.
Example: Extract Hour from Datetime in Excel
Suppose we have the following dataset in Excel that shows the number of sales made during various dates and times for some company:
Suppose we would like to extract the hour from each datetime in column A.
To do so, we can type the following formula into cell C2:
We can then click and drag this formula down to each remaining cell in column C:
Column C now displays only the hour value from each datetime in column A.
If you would also like to extract the minutes along with the hour, you can use the following formula instead:
The following screenshot shows how to use this formula in practice:
Column C now contains both the hours and minutes for each datetime in column A.
Note that in this formula we used the MINUTE function to extract the minutes from the datetime and the & symbol to concatenate the hours and minutes.
The following tutorials explain how to perform other common operations in Excel: