In this article we will show you how to convert time to decimal in Google Sheets in just a few clicks. Simply follow the steps below:
The formula uses a combination of the HOUR, MINUTE, and SECOND functions:
=HOUR(time)+(MINUTE(time)/60) + (SECOND(time)/3600)
Where time is the cell containing the time to convert to decimal.
It will separate the hour, minute, and the second value from the time and then convert the minute and second to its corresponding decimal forms relative to the hour. 3600 is the number of seconds in 1 hour. The resulting decimal will be in hours.
Below are the steps to use this formula.
For our example, we have a sheet containing a set of timestamps in Column A. We want to convert them to time in hours, with minutes and seconds converted to decimals.
For Row 2, we have the time stored in cell A2 and we want to insert the formula to B2.
For Row 2, the time to convert is stored in cell A2. The formula becomes
=HOUR(A2)+(MINUTE(A2)/60) + (SECOND(A2)/3600)
You can insert this to B2.
Alternatively, you can type the formula by itself, clicking the cell A2 in the process, but it can take more time.
We now have the time converted to decimals!
If it is the first time you insert this formula, Google Sheets will do something. Check the next step.
If it is the first time you have inserted this formula, Google Sheets will suggest auto filling other rows with timestamps as well. Click the check mark.
The formula has been applied to all other rows.
You can also change the number of decimals by selecting the range, then clicking the Decrease decimal places icon along the main toolbar.
For our example we will click the icon a few times to reduce the number of decimals to two:
If instead you are given the number of hours with decimals, you can convert the decimals to minutes and seconds. Follow the steps above, but this time using the formula below:
=time(int(input), int((mod(input,1))*60), int((mod((mod(input,1))*60,1))*60))
This formula is lengthy. It has three parts:
int(input) isolates the hour
int((mod(input,1))*60) converts the decimal and isolates the minutes
int((mod((mod(input,1))*60,1))*60)) converts the decimal of minutes and isolate the seconds
And then combined using the TIME function. You can see this in action below.
We hope this article has helped you and given you a better understanding of how to convert time to decimal in Google Sheets. You might also like our articles on how to convert text to number in Google Sheets and how to export Google Calendar to Google Sheets.
To optimize your workflow, we recommend reading our guide on how to trigger emails when new rows are added.