Table of Contents
To extract the hour from a datetime value in Excel, use the HOUR function. This function takes a datetime value as its input and returns the hour portion of the value. The hour is returned in a 24-hour format, ranging from 0 to 23. This can be useful for organizing and analyzing data based on specific hours of the day. It is important to note that the datetime value must be in a recognizable format for the HOUR function to work properly.
Excel: Extract Hour from Datetime
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:
=HOUR(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:
=HOUR(A2)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:
=HOUR(A2)&":"&MINUTE(A2)
The following screenshot shows how to use this formula in practice:

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:
Cite this article
stats writer (2024). How can I extract the hour from a datetime value in Excel?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-extract-the-hour-from-a-datetime-value-in-excel/
stats writer. "How can I extract the hour from a datetime value in Excel?." PSYCHOLOGICAL SCALES, 22 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-extract-the-hour-from-a-datetime-value-in-excel/.
stats writer. "How can I extract the hour from a datetime value in Excel?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-extract-the-hour-from-a-datetime-value-in-excel/.
stats writer (2024) 'How can I extract the hour from a datetime value in Excel?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-extract-the-hour-from-a-datetime-value-in-excel/.
[1] stats writer, "How can I extract the hour from a datetime value in Excel?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How can I extract the hour from a datetime value in Excel?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
