Convert the time to an integer in Excel

Convert hours to numbers for Excel calculations

If you multiply a calculated number of hours by an hourly wage in an Excel spreadsheet to get a total wage, you will not get the result you want.

The wrong result occurs because Excel always displays the result as hours when calculating with hours.

For this reason, you have to convert the hours to a number so that you can calculate with two compatible values. The time specification 26:30 becomes the decimal number 26.5. To do this, use the DAYS, HOUR and MINUTE functions.

If cell B6 is the number of hours, enter the following formula in cell B4 for correct conversion to a decimal number:

 

= DAY (B6) * 24 + HOUR (B6) + MINUTE (B6) / 60

Make sure to use the "Standard" number format in the result cell. By default, Excel uses a date format. The following figure shows the use of the formula in practice:

The formula calculates the number of days contained in the date value and multiplies it by 24. The hours contained are added to this. Finally, the number of minutes is divided by 60 and also added. The result is a decimal number that you can directly multiply by hourly prices, hourly wages or the like.