Excel time value in formula

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less

This article describes the formula syntax and usage of the TIMEVALUE function in Microsoft Excel.

Description

Returns the decimal number of the time represented by a text string. The decimal number is a value ranging from 0 (zero) to 0.99988426, representing the times from 0:00:00 (12:00:00 AM) to 23:59:59 (11:59:59 P.M.).

Syntax

TIMEVALUE(time_text)

The TIMEVALUE function syntax has the following arguments:

  • Time_text    Required. A text string that represents a time in any one of the Microsoft Excel time formats; for example, «6:45 PM» and «18:45» text strings within quotation marks that represent time.

Remarks

  • Date information in time_text is ignored.

  • Time values are a portion of a date value and represented by a decimal number (for example, 12:00 PM is represented as 0.5 because it is half of a day).

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Formula

Description

Result

=TIMEVALUE(«2:24 AM»)

Decimal part of a day, with only the time specified.

0.10

=TIMEVALUE(«22-Aug-2011 6:35 AM»)

Decimal part of a day, with date and time specified.

0.2743

Need more help?

How to Calculate Time in Excel (A Complete Tutorial and Helpful Formulas)

If you’ve been relying on Excel to manage your projects and need help with time calculations, you’re not alone. Figuring out the elapsed time of a project or task is crucial for team leads that need to know what work should be prioritized and how to properly allocate resources.

Simply put, time values are tricky in Excel—especially when calculating time difference, hours worked, or the difference between two employees.

Luckily for you, we’ve done all the hard work to help format cells and calculate elapsed time in Excel faster. Let’s get confident about using Excel for project time tracking and discover the various ways of figuring time.

How to Calculate Time in Excel (A Complete Tutorial and Helpful Formulas)

Types of Time Calculations in Excel

There isn’t a single formula or format for calculating time in Excel. It depends on your dataset and the goal you want to achieve. Most use a custom format (number over text function) to understand time and date values, or the time difference value.

But there are two types of calculations to get you started, which include:

  • Add time: If you need to obtain the sum of two time values to get a total
    • Add up to less than 24 hours: When you need to know how many hours and minutes it’ll take to complete two simple tasks
    • Add up to more than 24 hours: When you need to add the estimated or actual elapsed time of multiple slow, complex tasks
  • Subtract time: If you need to get the total time between a start and end times
    • Subtract times whose difference is less than 24 hours: When you need to figure out the hours elapsed since a team member started to execute a simple task
    • Subtract times whose difference is more than 24 hours: When you need to know the hours that have gone by since your project started

Let’s go through a few formulas for time calculations in Excel so you get down to the exact hours, minutes, and seconds in your custom time format.

Time Difference in Excel

Before we teach you how to calculate time in Excel, you must understand what time values are in the first place. Time values are the decimal number to which Excel applied a time format to make them look like times (i.e., the hours, minutes, and seconds).

Because Excel times are numbers, you can add and subtract them. And the difference between a start time and an end time is called “time difference” or “elapsed time.”

These are the steps to subtract times whose difference is less than 24 hours:

1. Enter the start date and time in cell A2 and hit Enter. Don’t forget to write “AM” or “PM”
2. Enter the end time in cell B2 and hit Enter
3. Enter the formula =B2-A2 in cell C2 and hit Enter.

Same Day Time Format in Excel example
An example of subtracting time on the same day in Excel

WARNING
As you can tell from the figure, this formula doesn’t work for times that belong to different days. This example shows the time difference between two time values within a 24-hour time period.

4. Right-click on C2 and select Format Cells.

example of formatting Cells for time values in excel
The custom value can be set up in various date format options

5. Choose the Custom category and type “h:mm”

SIDE NOTE
You might wish to obtain the time difference expressed in hours or hours, minutes, and seconds. If so, type “h” or “h:mm:ss,” respectively. This will help you avoid negative time values.

6. Click OK to see the total change to a format describing only the number of hours and minutes in the elapsed time between A2 and B2.

Example format showing the number of hours and minutes
Example format showing the hours and minutes

Check out our detailed blog to find a list of time management strategies you can use right away!

Date and time in Excel

In the previous section, you learned how to calculate hours in Excel. But the formula you learned only applied to time differences of less than 24 hours.

If you need to subtract times whose difference is more than 24 hours, you need to work with dates besides times. Do it like this (format cells dialog box):

1. Enter the start time in cell A2 and hit Enter.
2. Enter the end time in cell B2 and hit Enter.
3. Right-click on A2 and select Format Cells.
4. Choose the Custom category and type “m/d/yyyy h:mm AM/PM.”
5. Click OK to see A2 change to a format starting with “1/0/1900” and adjust the date.
6. Use the Format Painter to copy the formatting of A2 to B2 and adjust the date.
7. Enter the formula =(B2-A2)*24 in cell C2 and hit Enter to see the total change to a format describing the number of hours in the time elapsed between A2 and B2.

Total Change to subtract times example in excel

Example of the total change to subtract times in Excel

WARNING
You must apply the “Number” format to C2 to get the correct value in the above formula.

Sum time in Excel

Suppose you want to sum up the time difference between your team members working on multiple project tasks. If those durations add up to less than 24 hours, follow these steps:

1. Enter one duration in cell B2 (with the format h:mm) and hit Enter.
2. Enter the other duration in cell B3 and hit Enter.
3. Enter the formula =B2+B3 in cell B4 and hit Enter.

Example of combining times that equal less than 24 hours
Example of combining times that equal less than 24 hours in Excel formulas (Column B)

PRO TIP
If you prefer clicking a single button instead of entering a formula, you may position the cursor in B4 and hit the Σ (or AutoSum) button in the Home tab. The button will apply the formula =SUM(B2:B3) to the cell in the above example.

If the total duration of your project tasks adds up to more than 24 hours, follow these steps instead:

1. Enter one duration in cell B2 (with the format h:mm) and hit Enter. (Warning: Beware that the maximum duration is 23 hours and 59 minutes)
2. Enter the other duration in cell B3 and hit Enter.
3. Enter the formula =B2+B3 in cell B4 and hit Enter.
4. Right-click on B4 and select Format Cells.
5. Choose the Custom category and type “[h]:mm;@.”
6. Click OK to see B4 correctly displaying the sum of the times in B2 and B3.

Example of combining times that equal more than 24 hours
Example of combining values that equals more than 24 hours (Column B)

If you’d like to know more about Excel project management, our blog is the perfect place to start!

The Complete List of Formulas for Calculating Time in Excel

It pays to know the formulas when you’re calculating time difference in Excel. To get your time difference and value set up correctly, we’ve provided a list of formulas to make your calculations easier.

Formula Description
=B2-A2 Difference between the two time values in cells A2 and B2
=(B2-A2)*24 Hours between the value in cells A2 and B2 (24 being the number of hours in a day)

 Warning: If the difference is 24+ hours, you must apply the “Custom” format with the type “m/d/yyyy h:mm AM/PM” to A2 and B2. You also must apply the “Number” format to the cell containing the time difference formula.

=TIMEVALUE(“8:02 PM”)-TIMEVALUE(“9:15 AM”) Warning: The difference must be less than 24 hours.
=TEXT(B2-A2,”h”) Hours between the values in cells A2 and B2

 Warning: You must apply the “Custom” format with the type “h” to A2 and B2. Also, the value in B2 cannot be less than A2 and the difference must be less than 24 hours to avoid a negative value. And the TEXT function returns a textual value.

=TEXT(B2-A2,”h:mm”) Minutes and hours between the time values in cells A2 and B2.

 Warning: You must apply the “Custom” format with the type “h:mm” to A2 and B2. Also, the value in B2 cannot be less than A2 and the difference must be less than 24 hours.

=TEXT(B2-A2,”h:mm:ss”) Hours, minutes, and seconds between the time values in cells A2 and B2.

 Warning: You must apply the “Custom” format with the type “h:mm:ss” to A2 and B2. And the value in B2 cannot be less than A2 and the difference must be less than 24 hours.

=INT((B2-A2)*24) Number of complete hours between the time values in cells A2 and B2 (24 being hours in a day).

 Warning: If the difference is 24+ hours, you must apply the “Custom” format with the type “m/d/yyyy h:mm AM/PM” to A2 and B2. And you must apply the “Number” format to the cell containing the time difference formula.

=(B2-A2)*1440 Minutes between the time values in cells A2 and B2 (1440 being minutes in a day).

Warning: If the difference is 24+ hours, you must apply the “Custom” format with the type “m/d/yyyy h:mm AM/PM” to A2 and B2. And you must apply the “Number” format to the cell containing the time difference formula.

=(B2-A2)*86400 Seconds between the time values in cells A2 and B2 (86400 being the seconds in a day).
 
Warning: If the difference is 24+ hours, you must apply the “Custom” format with the type “m/d/yyyy h:mm AM/PM” to A2 and B2. And you must apply the “Number” format to the cell containing the time difference formula.
=HOUR(B2-A2) Hours between the time values in cells A2 and B2.

Warning: The value in B2 cannot be less than the value in A2 and the difference must be less than 24 hours. Also, the HOUR function returns a numeric value.

=MINUTE(B2-A2) Minutes between the time values in cells A2 and B2.

 Warning: The value in B2 cannot be less than the value in A2 and the difference must be less than 60 minutes. Also, the MINUTE function returns a numeric value.

=SECOND(B2-A2) Seconds between the time values in cells A2 and B2.

 Warning: The value in B2 cannot be less than the value in A2 and the difference must be less than 60 seconds. Also, the SECOND function returns a numeric value.

=NOW()-A2 Time elapsed between the date and time in cell A2 and the current date and time.

 Warning: If the elapsed time is 24+ hours, you must apply the “Custom” format with the type “d “days” h:mm:ss” to the cell containing the time difference formula. Also, Excel doesn’t update the elapsed time in real-time. To do that, you must hit Shift+F9.

=TIME(HOUR(NOW()),MINUTE(NOW()),SECOND(NOW()))-A2 Time elapsed between the value in cell A2 and the current date and time.

 Warning: Excel doesn’t update the elapsed time in real-time. To do that, you must hit Shift+F9.

=INT(B2-A2)&” days, “&HOUR(B2-A2)&” hours, “&MINUTE(B2-A2)&” minutes, and “&SECOND(B2-A2)&” seconds” Time elapsed between the date and time or time values in cells A2 and B2, expressed in the format “dd days, hh hours, mm minutes, and ss seconds.”

 Warning: This formula returns a textual value. If you need the result to be a value, use the formula =B2-A2 and apply the “Custom” format with the type “d “days,” h “hours,” m “minutes, and” s “seconds”” to the cell containing the time difference formula.

=IF(INT(B2-A2)>0,INT(B2-A2)&” days,”,””)&IF(HOUR(B2-A2)>0,HOUR(B2-A2)&” hours,”,””)&IF(MINUTE(B2-A2)>0,MINUTE(B2-A2)&” minutes, and “,””)&IF(SECOND(B2-A2)>0,SECOND(B2-A2)&” seconds”,””) Time elapsed between the date and time or values in cells A2 and B2, expressed in the format “dd days, hh hours, mm minutes, and ss seconds” with zero values hidden.

 Warning: This formula returns a textual value. If you need the result to be a value, use the formula =B2-A2 and apply the “Custom” format with the type “d “days,” h “hours,” m “minutes, and” s “seconds”” to the cell containing the time difference formula.

=A2+TIME(1,0,0) Value in cell A2 plus one hour.

 Warning: This formula only allows adding less than 24 hours to a value.

=A2+(30/24) Value in cell A2 plus 30 hours (24 being hours in a day).

 Warning: This formula allows adding any number of hours to a value.

=A2-TIME(1,0,0) Time value in cell A2 minus one hour.

 Warning: This formula only allows subtracting less than 24 hours from a value.

=A2-(30/24) Time value in cell A2 minus 30 hours.

 Warning: This formula allows subtracting any number of hours from a value.

=A2+TIME(0,1,0) Time value in cell A2 plus one minute.

 Warning: This formula only allows adding less than 60 minutes to a value.

=A2+(100/1440) Time value in cell A2 plus 100 minutes (1440 being minutes in a day).

 Warning: This formula allows adding any number of minutes to a value.

=A2-TIME(0,1,0) Time value in cell A2 minus one minute.

 Warning: This formula only allows subtracting less than 60 minutes from a value.

=A2-(100/1440) Time value in cell A2 minus 100 minutes.

 Warning: This formula allows subtracting any number of minutes from a value.

=A2+TIME(0,0,1) Time value in cell A2 plus one second.

 Warning: This formula only allows adding less than 60 seconds to a value.

=A2+(100/86400) Time value in cell A2 plus 100 seconds (86400 being seconds in a day).

Warning: This formula allows adding any number of seconds to a value.

=A2-TIME(0,0,1) Time value in cell A2 minus one second.

 Warning: This formula only allows subtracting less than 60 seconds from a value.

=A2-(100/86400) Time value in cell A2 minus 100 seconds.

 Warning: This formula allows subtracting any number of seconds from a value.

=A2+B2

=SUM(A2:B2)

Total hours, hours and minutes, or hours, minutes, and seconds in the values from cells A2 and B2, depending on the format you applied to those cells.

 Warning: If the total adds up to more than 24 hours, you must apply the “Custom” format with the type “[h]:mm;@” to the cell containing the SUM formula.

An Easier Alternative to Calculating Time in Excel

Although the formulas in this article work, there’s a better way to calculate time—ClickUp!

Sure, spreadsheets are great for managing data, but what about your day-to-day tasks? And how do you communicate with your team to show these times in a simple and clear way?

Table view in ClickUp
Arrange all of your tasks on a grid alongside their key details including status, due date, assignees, and more with Table view in ClickUp

ClickUp’s Table view keeps track of all your tasks, including assignees, status, and due dates, with ease. Plus, the Table view lets you quickly check on the progress of each project task.

But that’s not all—you can copy and paste your table into other software, pin specific columns, auto-size your columns, and even share your tables through a unique link.

This simple interface makes it a breeze to drag and drop rows and columns to quickly change your view.

drag and drop tasks on a clickup table

Drag and drop tasks on a ClickUp Table View for simple organization

ClickUp is an all-in-one management software for time tracking and figuring time estimates while supporting dates and times fields, so you can finally break up with Excel for your project management needs.

Don’t believe us? Create your own table for free in ClickUp today!

TIME Formula in Excel

TIME is a time worksheet function in Excel that is used to make time from the arguments provided by the user. The arguments are in the following format: hours, minutes, and seconds. The range for the input for hours can be from 0-23, and for minutes it is 0-59 and similar for seconds. The method to use this function is as follows: =Time( Hours, Minutes, Seconds).

For example, TIME(0,0,3500) = 0.04050925 or 12:58:20 AM.

Table of contents
  • TIME Formula in Excel
    • Explanation
    • Usage Notes
    • How to Open the TIME Function in Excel?
    • How to Use TIME in Excel Sheet?
      • Example #1
      • Example #2
      • Example #3
      • Example #4
      • Example #5
      • Example #6
      • Example #7
      • Example #8
    • Excel TIME Function Errors
    • Things to Remember
    • TIME Function in Excel Video
    • Recommended Articles

TIME FORMULA

Explanation

The formula of TIME accepts the following parameters and arguments:

  • hour – This can be any number between 0 and 32767, representing the hour. The point to be noted for this argument is that if the hour value is larger than 23, it will then be divided by 24. The remainder of the division will be used as the hour value. For better understanding, TIME(24,0,0) will be equal to TIME(0,0,0), TIME (25,0,0) means TIME(1,0,0) and TIME(26,0,0) will be equal to TIME(2,0,0) and so on.
  • minute – This can be any number between 0 and 32767, representing the minute. For this argument, you should note that if the minute value is larger than 59, every 60 minutes will add up to 1 hour in the pre-existing hour value. For better understanding, TIME(0,60,0) will be equal to TIME(1,0,0) and TIME(0,120,0) will be equal to TIME(2,0,0) and so on.
  • second – This can be any number between 0 and 32767, representing the second. For this argument, you should note that if the second value exceeds 59, then every 60 seconds will be added 1 minute to the pre-existing minute value. For better understanding, TIME(0,0,60) will be equal to TIME(0,1,0) and TIME(0,0,120) will be equal to TIME(0,2,0) and so on.

Return Value of TIME Formula:

The return value will be a numeric value between 0 and 0.999988426, which represents a particular timesheet.

Usage Notes

  • The TIME in the Excel sheet is used for creating a date in serial number format from the hour, minute, and seconds components, which you specify.
  • The TIME sheet creates a correct time if you have the values of the above components separately. For example, TIME(3,0,0,) is equal to 3 hours, TIME(0,3,0) is equal to 3 minutes, TIME (0,0,3) is equal to 3 seconds, and TIME(8,30,0) is equal to 8.5 hours.
  • Once you get the right time, you can easily format it as per your requirements.

How to Open the TIME Function in Excel?

  1. You can enter the desired TIME formula in the required cell to attain a return value on the argument.
  2. You can manually open the TIME formula dialogue box in the spreadsheet and enter the logical values to attain a return value.
  3. Consider the screenshot below to see the formula of the TIME option under the DATE and TIME function in the Excel menu.

    TIME Function Step 2

How to Use TIME in Excel Sheet?

Take a look at the below-given examples of TIME in the ExcelTo add time in Excel, the user can directly enter the time values in the hh:mm format into the cell. Remember that the time entered in the cell should not exceed 24 hours. For instance, 5.30 in the evening is written as 17:30.read more sheet. These TIME function examples will help you explore the use of the TIME function in Excel and clarify the concept of the TIME function.

You can download this TIME Function Excel Template here – TIME Function Excel Template

TIME Function Example 1

The above screenshot shows that three columns have been included: D, E, and F. These columns have different formats that offer the results generated from the TIME function. Consider the following points for better understanding.

  • The column D cells are formatted with the “General” format to display the result from the TIME function in decimal values.
  • The column E cells are formatted with the default h:mm AM/PM format. It is how Excel automatically formats the results once you enter the TIME formula.
  • The column F cells are formatted with h:mm:ss AM/PM custom format. It will help you see the full hours, minutes, and seconds.

Based on the above Excel spreadsheet, let us consider eight examples and see the TIME function return based on the syntax.

Note- To attain the result, you must enter the TIME formula in all three columns, D, E, and F cells.

TIME FUnction Example 1

Consider the screenshots of the above examples for a clear understanding.

Example #1

TIME Function Example1

Example #2

TIME Function Example2

Example #3

TIME Function Example3

Example #4

Example 4

Example #5

Example 5

Example #6

Example 6

Example #7

Example 7

Example #8

Example8

Excel TIME Function Errors

If you get any error from the TIME function, it can be one of the following.

#NUM! – This kind of error occurs if the argument provided by you is evaluating a negative time; for example, if the supplied hour is less than 0.

#VALUE! – This kind of error occurs if any of the arguments are supplied by you in non-numeric.

Things to Remember

  • The TIME function in Excel allows you to create time with individual hour, minute, and second components.
  • The TIME in Excel is categorized under the DATE and TIME functions.
  • The TIME function will return a decimal value between 0 and 0.999988426, giving an hour, minute, and second value.
  • After using the TIME on Excel, once you get the right time, we can easily format it as per the requirements.

TIME Function in Excel Video

Recommended Articles

This article has been a guide to TIME Function in Excel. Here, we discuss the TIME formula in Excel and how to use the TIME function, along with Excel examples and downloadable Excel templates. You may also look at these useful functions in Excel: –

  • Subtract Time in Excel FormulaFor subtraction of time values less than 24 hours, we can easily subtract using the ‘-’ operator. However, the time values that on subtraction exceed 24 hours/60 minutes/60 seconds are ignored by Excel. Therefore, we use a custom number format in such cases.read more
  • Timeline ChartIn project management terms, an Excel timeline chart is also known as a Milestone chart. It is used to visually track all stages of a project and assists a project manager in delivering the project to the end-user as committed before the start of the project.read more
  • DAY FunctionIn Excel, the DAY function calculates the day value from a given date. This function accepts a date as an argument and returns a two-digit numeric value as an integer value representing the given date’s day. The formula to use this function is =Edate(serial number).read more
  • TODAY Excel FunctionToday function is a date and time function that is used to find out the current system date and time in excel. This function does not take any arguments and auto-updates anytime the worksheet is reopened. This function just reflects the current system date, not the time.read more
  • Search For Text in ExcelExcel provides the functionality that helps you to search for text in the file. You can use Find and Search function to search for a specific text cell value and arrive at the result.read more

Reader Interactions

Skip to content

Как посчитать время – разницу, сумму, добавить или вычесть

В статье рассматривается, как в Excel посчитать время. Вы найдете несколько полезных формул чтобы посчитать сумму времени, разницу во времени или сколько времени прошло и многое другое.

Ранее мы внимательно рассмотрели особенности формата времени Excel и возможности основных функций времени. Сегодня мы углубимся в вычисления времени в Excel, и вы узнаете еще несколько формул для эффективного управления временем в ваших таблицах.

Как посчитать разницу во времени в Excel (прошедшее время)

Для начала давайте посмотрим, как можно быстро посчитать в Excel сколько прошло времени, т.е. найти разницу между временем начала и временем окончания. И, как это часто бывает, существует несколько способов для расчета времени. Какую из них выбрать, зависит от вашего набора данных и того, какого именно результата вы пытаетесь достичь. Итак, давайте посмотрим несколько вариантов.

Вычесть одно время из другого

Как вы, наверное, знаете, время в Excel — это обычные десятичные числа, отформатированные так, чтобы они выглядели как время. И поскольку это числа, вы можете складывать и вычитать время так же, как и любые другие числовые значения.

Самая простая и очевидная формула Excel чтобы посчитать время от одного момента до другого:

Время окончания — Время начала

В зависимости от ваших данных, формула разницы во времени может принимать различные формы, например:

Формула Пояснение
=A2-B2 Вычисляет разницу между временами в ячейках A2 и B2.
=ВРЕМЗНАЧ(«21:30») — ВРЕМЗНАЧ («8:40») Вычисляет разницу между указанными моментами времени, которые записаны как текст.
=ВРЕМЯ(ЧАС(A2); МИНУТЫ(A2); СЕКУНДЫ(A2)) — ВРЕМЯ (ЧАС (B2); МИНУТЫ (B2); СЕКУНДЫ (B2)) Вычисляет разницу во времени между значениями в ячейках A2 и B2, игнорируя разницу в датах, когда ячейки содержат значения даты и времени.

Помня, что во внутренней системе Excel время представлено дробной частью десятичного числа, вы, скорее всего, получите результаты, подобные этому скриншоту:

В зависимости оп применяемого форматирования, в столбце D вы можете увидеть десятичные дроби (если установлен формат Общий). Чтобы сделать результаты более информативными, вы можете настроить отображаемый формат времени с помощью одного из следующих шаблонов:

Формат Объяснение
ч Прошедшее время отображается только в часах, например: 4.
ч:мм Прошедшие часы и минуты отображаются в формате 4:50.
ч:мм:сс Прошедшие часы, минуты и секунды отображаются в формате 4:50:15.

Чтобы применить пользовательский формат времени, используйте комбинацию клавиш Ctrl + 1, чтобы открыть диалоговое окно «Формат ячеек», выберите «Пользовательский»  и введите шаблон формата в поле «Тип». Подробные инструкции вы можете найти в статье Создание пользовательского формата времени в Excel .

А теперь давайте разберем это на простых примерах. Если время начала находится в столбце B, а время окончания — в столбце A, вы можете использовать эту простую формулу:

=$A2-$B2

Прошедшее время отображается по-разному в зависимости от использованного формата времени, как видно на этом скриншоте:

Примечание. Если время отображается в виде решеток (#####), то либо ячейка с формулой недостаточно широка, чтобы вместить полученный результат, либо итогом ваших расчетов времени является отрицательное число. Отрицательное время в Экселе недопустимо, но это ограничение можно обойти, о чем мы поговорим далее.

Вычисление разницы во времени с помощью функции ТЕКСТ

Еще один простой метод расчета продолжительности между двумя временами в Excel — применение функции ТЕКСТ:

  • Рассчитать часы между двумя временами:   =ТЕКСТ(A2-B2; «ч»)
  • Рассчитать часы и минуты:                             =ТЕКСТ(A2-B2;»ч:мм»)
  • Посчитать часыминуты и секунды:              =ТЕКСТ(A2-B2;»ч:мм:сс»)

Как видно на скриншоте ниже, вы сразу получаете время в нужном вам формате. Специально устанавливать пользовательский формат ячейки не нужно.

Примечание:

  • Значение, возвращаемое функцией ТЕКСТ, всегда является текстом. Обратите внимание на выравнивание по левому краю содержимого столбцов C:E на скриншоте выше. В некоторых случаях это может быть существенным ограничением, поскольку вы не сможете использовать полученное «текстовое время» в других вычислениях.
  • Если результатом является отрицательное число, ТЕКСТ возвращает ошибку #ЗНАЧ!.

Как сосчитать часы, минуты или секунды

Чтобы получить разницу во времени только в какой-то одной единице времени (только в часах, минутах или секундах), вы можете выполнить следующие вычисления.

Как рассчитать количество часов.

Чтобы представить разницу в часах между двумя моментами времени в виде десятичного числа, используйте следующую формулу:

=( Время окончания — Время начала ) * 24

Если начальное время записано в A2, а время окончания – в B2, вы можете использовать простое выражение B2-A2, чтобы вычислить разницу между ними, а затем умножить результат на 24. Это даст количество часов:

=(B2-A2)* 24

Чтобы получить количество полных часов, используйте функцию ЦЕЛОЕ, чтобы округлить результат до ближайшего целого числа:

=ЦЕЛОЕ((B2-A2) * 24)

Пример расчета разницы во времени только в одной единице измерения вы видите на скриншоте ниже.

Считаем сколько минут в интервале времени.

Чтобы вычислить количество минут между двумя метками времени, умножьте разницу между ними на 1440, что соответствует количеству минут в одном дне (24 часа * 60 минут = 1440).

=( Время окончания — Время начала ) * 1440

Как показано на скриншоте выше, формула может возвращать как положительные, так и отрицательные значения. Отрицательные возникают, когда время окончания меньше времени начала, как в строке 5:

=(B2-A2)*1440

Как сосчитать количество секунд.

Чтобы посчитать разницу в секундах между двумя моментами времени, вы умножаете разницу во времени на 86400, что соответствует числу секунд в одном дне (24 часа * 60 минут * 60 секунд = 86400).

=( Время окончания — Время начала ) * 86400

В нашем примере расчет выглядит следующим образом:

=(B2-A2)* 86400

Примечание. Чтобы результаты отображались правильно, к ячейкам с вашей формулой разницы во времени следует применить общий либо числовой формат.

Как посчитать разницу в каждой единице времени.

Чтобы найти разность между двумя точками времени и выразить ее только в одной определенной единице времени, игнорируя остальные, используйте одну из следующих функций.

  • Разница в часах без учета минут и секунд:

=ЧАС(B2-A2)

  • Разница в минутах без учета часов и секунд:

=МИНУТЫ(B2-A2)

  • Разница в секундах без учета часов и минут:

=СЕКУНДЫ(B2-A2)

При использовании функций Excel ЧАС, МИНУТЫ и СЕКУНДЫ помните, что результат не может превышать 24 для часов, и 60 – для минут и секунд.

В данном случае не играет роли, сколько дней прошло с даты начала до даты окончания. Учитывается только дробная часть числа, то есть время.

Примечание. Однако,если в ячейку вы записали не просто время, а дату и время, и при этом дата окончания окажется меньше даты начала (т. е. результатом будет отрицательное число), то вы увидите ошибку #ЧИСЛО!.

Как перевести секунды в часы, минуты и секунды

Часто случается, что длительность какого-то события представлена в каких-то одних единицах времени. К примеру, различные приборы зачастую возвращают измеренное ими время в секундах. И это число нам нужно перевести в привычный формат времени – в часы, минуты и секунды, а при необходимости – еще и в дни.

Давайте рассмотрим небольшой пример.

Предположим, зафиксирована продолжительность события 284752 секунд. Переведем число секунд в дни, часы, минуты и секунды.

Вот как это будет:

Дни:

=ЦЕЛОЕ(A2/(60*60*24))

Часы:

=ЦЕЛОЕ(A2/(60*60)) — ЦЕЛОЕ(A2/(60*60*24))*24

Минуты:

=ЦЕЛОЕ(A2/60) — ЦЕЛОЕ(A2/(60*60))*60

Секунды – это просто две последние цифры:

=—ПРАВСИМВ(A2;2)

Если нужно рассчитать время только в часах, минутах и секундах, то изменим формулу подсчета часов:

=ЦЕЛОЕ(A2/(60*60))

Конечно, здесь результат может быть больше 24.

Минуты и секунды подсчитываем, как и прежде.

Еще один вариант перевода секунд в дни, часы, минуты и секунды вы можете посмотреть на скриншоте ниже.

Расчет времени с момента начала до настоящего момента

Чтобы рассчитать, сколько времени прошло с какой-то даты до настоящего момента, вы просто используете функцию ТДАТА, чтобы вернуть сегодняшнюю дату и текущее время, а затем вычесть из них  дату и время начала.

Предположим, что начальная дата и время находятся в A2, выражение =ТДАТА()-A2 возвращает следующие результаты, при условии, что вы применили соответствующий формат времени к столбцу B (в этом примере «ч:мм») :

Если прошло больше чем 24 часа, используйте один из этих форматов времени , например Д «дн.» ч:мм:сс, как показано на скриншоте ниже:

Если ваши начальные данные содержат только время без дат, вам нужно использовать функцию ВРЕМЯ, чтобы правильно рассчитать, сколько времени прошло. Например, следующая формула возвращает время, истекшее с момента, указанного в ячейке A2, и до текущего момента:

=ВРЕМЯ(ЧАС(ТДАТА()); МИНУТЫ(ТДАТА()); СЕКУНДЫ(ТДАТА())) — A2

Примечание. Прошедшее время не обновляется в режиме реального времени, оно заново рассчитывается только при повторном открытии или пересчете рабочей книги. Чтобы принудительно обновить результат, нажмите либо Shift + F9, чтобы пересчитать активную таблицу, или F9 для пересчета всех открытых книг. Еще один способ быстрого пересчета – внесите изменения в любую ячейку вашего рабочего листа.

Отображение разницы во времени как «XX дней, XX часов, XX минут и XX секунд».

Это, вероятно, самая удобная формула для расчета разницы во времени в Excel. Вы используете функции ЧАС, МИНУТЫ и СЕКУНДЫ для возврата соответствующих единиц времени, и функцию ЦЕЛОЕ для вычисления разницы в днях. Затем вы объединяете все эти функции в одно выражение вместе с текстовыми пояснениями:

=ЦЕЛОЕ(B2-A2)&» дн., «&ЧАС(B2-A2)&» час., «&МИНУТЫ(B2-A2)&» мин. и «&СЕКУНДЫ(B2-A2)&» сек.»

Вот как это может выглядеть:

Чтобы скрыть нулевые результаты в формуле разницы во времени в Excel, встройте в нее четыре функции ЕСЛИ:

=ЕСЛИ(ЦЕЛОЕ(B2-A2)>0; ЦЕЛОЕ(B2-A2) & » дн.,  «;»») &

ЕСЛИ(ЧАС(B2-A2)>0; ЧАС(B2-A2) & » час.,  «;»») &

ЕСЛИ(МИНУТЫ(B2-A2)>0; МИНУТЫ(B2-A2) & » мин. и  «;»») &

ЕСЛИ(СЕКУНДЫ(B2-A2)>0; СЕКУНДЫ(B2-A2) & » сек.»;»»)

Синтаксис может показаться чрезмерно сложным, но это работает :)

Кроме того, вы можете рассчитать разницу во времени, просто вычитая время начала из времени окончания (например =B2-A2 ), а затем применив к ячейке следующий формат времени:

Д «дн.,» ч «час.,» м «мин. и » с «сек.»

Преимущество этого подхода заключается в том, что вашим результатом будет обычное значение времени, которое вы можете задействовать в других расчетах, в то время как результатом сложной формулы, описанной выше, является текст. 

Недостатком же здесь является то, что пользовательский формат времени не может различать нулевые и ненулевые значения и игнорировать нули.

Как рассчитать и отобразить отрицательное время в Excel

При расчете разницы во времени в Excel вы иногда можете получить результат в виде ошибки ######, если вдруг она представляет собой отрицательное число. Это происходит, если время начала больше, чем время окончания события. Такое часто случается, если рассчитывают продолжительность каких-то событий без учета даты. Получается, что время окончания меньше, чем время начала, поскольку это просто время следующего дня. К примеру, мы начинаем работу в 17 часов и заканчиваем на следующий день в 10 часов.

Но есть ли способ правильно отображать отрицательное время в Excel? Конечно, способ есть, и даже не один.

Способ 1. Измените систему дат Excel на систему дат 1904 года.

Самый быстрый и простой способ нормально отображать отрицательное время (со знаком минус) — это перейти на систему дат 1904 года. Для этого нажмите « Файл» > «Параметры» > «Дополнительно », прокрутите вниз до раздела « При расчете этой книги» и поставьте галочку в поле «Использовать систему дат 1904».

Нажмите OK , чтобы сохранить новые настройки, и теперь отрицательные величины времени будут отображаться правильно, как отрицательные числа:

Как видите, время начала больше, чем время окончания, и результат получен со знаком «минус».

Способ 2. Рассчитать отрицательное время в Excel с помощью формул

Если изменить систему дат по умолчанию в Excel нецелесообразно, вы можете заставить отрицательное время отображаться правильно, используя одну из следующих формул:

=ЕСЛИ(A2-B2>0; A2-B2; «-» & ТЕКСТ(ABS(A2-B2);»ч:мм»))

=ЕСЛИ(A2-B2>0; A2-B2; ТЕКСТ(ABS(A2-B2);»-ч:мм»))

Они обе проверяют, является ли отрицательной разница во времени (A2-B2). Если она меньше нуля, первая формула вычисляет абсолютное значение (без учёта знака) и объединяет этот результат со знаком «минус». Вторая формула делает точно такой же расчет, но использует отрицательный формат времени «-ч::мм «.

Примечание. Имейте в виду, что в отличие от первого метода, который обрабатывает отрицательное время как отрицательное число, результатом функции ТЕКСТ всегда является текстовая строка, которую нельзя использовать в математических вычислениях.

Если же текстовый формат для вас нежелателен, то вы можете определить разницу во времени в абсолютном выражении, игнорируя знаки.

На случай если время окончания меньше, чем время начала, мы можем проверить это при помощи функции ЕСЛИ.

=ЕСЛИ(B2<A2;B2+1;B2)-A2

Если разница во времени отрицательная, ко времени окончания добавляем 1 день (24 часа).  В результате получим правильную разницу во времени, но без знака «минус».

Сложение и вычитание времени в Excel

По сути, есть 2 способа сложения и вычитания времени в Excel:

  • При помощи функции ВРЕМЯ.
  • Применяя арифметические вычисления, основанные на количестве часов (24), минут (1440) и секунд (86400) в одних сутках.

Функция ВРЕМЯ(часы; минуты; секунды) делает вычисления времени в Excel очень простыми, однако не позволяет добавлять или вычитать более 23 часов, 59 минут или 59 секунд. 

Если вы работаете с большими временными интервалами, то используйте один из способов, описанных ниже.

Как добавить или вычесть часы

Чтобы добавить часы к заданному времени в Excel, вы можете взять на вооружение одну из следующих формул.

Функция ВРЕМЯ для добавления до 24 часов

Время начала + ВРЕМЯ( N часов ; 0 ; 0)

Например, если ваше время начала записано в ячейке A2, и вы хотите добавить к нему 2 часа, формула выглядит следующим образом:

=A2 + ВРЕМЯ(4; 0; 0)

Примечание. Если вы попытаетесь добавить более 23 часов с помощью функции ВРЕМЯ, указанные часы будут разделены на 24, а остаток от деления будет добавлен к времени начала. Например, если вы попытаетесь добавить 28 часов к «10:00» (ячейка A2) с помощью формулы =A4 + ВРЕМЯ(28; 0; 0), результатом будет «14:00», т. е. A2 + 4 часа.

Как добавить любое количество часов (меньше или больше 24 часов)

Следующая формула не имеет ограничений на количество часов, которые вы хотите добавить:

Время начала + ( N часов / 24)

Например, чтобы добавить 36 часов к времени начала в ячейке A2:

=A2 + (36/24)

Чтобы вычесть часы из заданного времени, вы используете аналогичные формулы и просто заменяете «+» знаком «-»:

Например, чтобы вычесть 40 часов из времени в ячейке A2, можно употребить формулу:

=A2-(40/24)

Если вычитаем менее чем 24 часа, то используйте функцию ВРЕМЯ:

=A2 — ВРЕМЯ(4; 0; 0)

Как прибавить или вычесть минуты

Чтобы добавить минуты к заданному времени, используйте те же методы, которые мы только что использовали для добавления часов.

Чтобы добавить или вычесть менее 60 минут

Используйте функцию ВРЕМЯ и укажите минуты, которые вы хотите добавить или вычесть, во втором аргументе:

Время начала + ВРЕМЯ(0; N минут ; 0)

Вот несколько примеров для расчета минут в Excel:

Чтобы добавить 30 минут ко времени в A2:  =A2 + ВРЕМЯ(0;30;0)

Чтобы вычесть 50 минут из времени в A2:     =A2 — ВРЕМЯ(0;50;0)

Как добавить или вычесть более 60 минут

При расчете разделите количество минут на 1440, то есть на количество минут в сутках, и прибавьте получившееся число к времени начала:

Время начала + ( N минут / 1440)

Чтобы вычесть минуты из времени, просто замените плюс знаком минус. Например:

Чтобы добавить 600 минут:     =A2 + (600/1440)

Чтобы вычесть 600 минут:        =A2 — (600/1440)

Как прибавить или вычесть секунды

Подсчеты с секундами в Excel выполняются аналогичным образом как с минутами. Ограничение здесь, как вы понимаете, 60 секунд.

Чтобы добавить менее 60 секунд к заданному времени, вы можете использовать функцию ВРЕМЯ:

Время начала + ВРЕМЯ(0; 0; N секунд )

Чтобы добавить более 59 секунд, используйте следующую формулу:

Время начала + ( N секунд / 86400)

86400 – это количество секунд в сутках.

Чтобы вычесть секунды, используйте те же формулы, только со знаком минус (-) вместо плюса (+).

Это может выглядеть примерно так:

Чтобы добавить 50 секунд к A2:         =A2 + ВРЕМЯ(0;0;50)

Чтобы добавить 1500 секунд к A2:      =A2 + (1500/86400)

Чтобы вычесть 25 секунд из A2:          =A2 — ВРЕМЯ(0;0;25)

Чтобы вычесть 2500 секунд из A2:      =A2 — (2500/86400)

Примечание:

  • Если вычисленное время отображается в виде десятичного числа, примените настраиваемый формат даты/времени к ячейкам.
  • Если после применения пользовательского форматирования в ячейке отображается #########, то скорее всего, ячейка недостаточно широка для отображения даты и времени. Чтобы исправить это, увеличьте ширину столбца, дважды щелкнув или перетащив правую его границу.

Как суммировать время в Excel

Формула суммирования времени в Excel — это обычная функция СУММ, и применение правильного формата времени к результату — это то, что помогает получить верный результат.

Предположим, у вас есть сведения об отработанном времени в столбце B, и вы хотите его суммировать, чтобы посчитать общее количество рабочих часов за неделю. Вы пишете простую формулу СУММ 

=СУММ(B2:B8)

 Затем устанавливаете в ячейке нужный формат времении получаете результат, как на скриншоте ниже.

В некоторых случаях формат времени по умолчанию работает просто отлично, но иногда вам может понадобиться более тонкая настройка шаблона, например, для отображения общего времени в виде минут и секунд или только секунд. Хорошей новостью является то, что никаких других вычислений не требуется. Все, что вам нужно сделать, это применить правильный формат времени к ячейке.

Щелкните правой кнопкой мыши ячейку и выберите «Формат ячеек» в контекстном меню или нажмите Ctrl + 1, чтобы открыть диалоговое окно «Формат ячеек». Выберите «Пользовательский» и введите один из следующих форматов времени в поле «Тип»:

  • Чтобы отобразить общее время в часах и ​​минутах: [ч]:мм
  • Чтобы отобразить общее время в минутах и ​​секундах: [м]:сс
  • Чтобы отобразить общее время в секундах: [сс]

Примечание. Вышеупомянутые пользовательские форматы времени работают только для положительных значений. Если результатом ваших расчетов времени является отрицательное число, например, когда вы вычитаете большее время из меньшего, результат будет отображаться как #####. Чтобы по-другому отображать отрицательное время, см. раздел Пользовательский формат для отрицательных значений времени .

Кроме того, имейте в виду, что формат времени, примененный к ячейке, изменяет только представление на дисплее, не изменяя содержимое ячейки.  На самом деле это обычное время, которое хранится в виде десятичной дроби во внутренней системе Excel. Это означает, что вы можете свободно ссылаться на него в других формулах и вычислениях.

Вот как вы можете рассчитывать время в Excel. Чтобы узнать о других способах управления датами и временем в Excel, я рекомендую вам ознакомиться с ресурсами в конце этой статьи. Я благодарю вас за чтение и надеюсь увидеть вас в нашем блоге. 

Как перевести время в число В статье рассмотрены различные способы преобразования времени в десятичное число в Excel. Вы найдете множество формул для преобразования времени в часы, минуты или секунды. Поскольку Microsoft Excel использует числовую систему для работы с временем, вы можете…
Формат времени в Excel Вы узнаете об особенностях формата времени Excel, как записать его в часах, минутах или секундах, как перевести в число или текст, а также о том, как добавить время с помощью…
Как вывести месяц из даты На примерах мы покажем, как получить месяц из даты в таблицах Excel, преобразовать число в его название и наоборот, а также многое другое. Думаю, вы уже знаете, что дата в…
Как быстро вставить сегодняшнюю дату в Excel? Это руководство показывает различные способы ввода дат в Excel. Узнайте, как вставить сегодняшнюю дату и время в виде статической метки времени или динамических значений, как автоматически заполнять столбец или строку…
Количество рабочих дней между двумя датами в Excel Довольно распространенная задача: определить количество рабочих дней в период между двумя датами – это частный случай расчета числа дней, который мы уже рассматривали ранее. Тем не менее, в Excel для…

Содержание

  1. TIME function
  2. Description
  3. Syntax
  4. Remark
  5. Example
  6. Add or subtract time
  7. Add time
  8. Subtract time
  9. Add time
  10. Subtract time
  11. Date and time functions (reference)
  12. TIMEVALUE Function – Text to Time in Excel, VBA, G Sheets
  13. TIMEVALUE Function Overview
  14. TIMEVALUE Function Syntax and Inputs:
  15. Function Arguments ( Inputs ):
  16. TIMEVALUE Examples
  17. Convert Time Stored as Text to Time
  18. Things to know about the TIMEVALUE Function:
  19. TIMEVALUE in Google Sheets
  20. TIMEVALUE Examples in VBA
  21. TIME Excel Function
  22. TIME Formula in Excel
  23. Explanation
  24. Usage Notes
  25. How to Open the TIME Function in Excel?
  26. How to Use TIME in Excel Sheet?
  27. Example #1
  28. Example #2
  29. Example #3
  30. Example #4
  31. Example #5
  32. Example #6
  33. Example #7
  34. Example #8
  35. Excel TIME Function Errors
  36. Things to Remember
  37. TIME Function in Excel Video
  38. Recommended Articles

TIME function

This article describes the formula syntax and usage of the TIME function in Microsoft Excel.

Description

Returns the decimal number for a particular time. If the cell format was General before the function was entered, the result is formatted as a date.

The decimal number returned by TIME is a value ranging from 0 (zero) to 0.99988426, representing the times from 0:00:00 (12:00:00 AM) to 23:59:59 (11:59:59 P.M.).

Syntax

TIME(hour, minute, second)

The TIME function syntax has the following arguments:

Hour Required. A number from 0 (zero) to 32767 representing the hour. Any value greater than 23 will be divided by 24 and the remainder will be treated as the hour value. For example, TIME(27,0,0) = TIME(3,0,0) = .125 or 3:00 AM.

Minute Required. A number from 0 to 32767 representing the minute. Any value greater than 59 will be converted to hours and minutes. For example, TIME(0,750,0) = TIME(12,30,0) = .520833 or 12:30 PM.

Second Required. A number from 0 to 32767 representing the second. Any value greater than 59 will be converted to hours, minutes, and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 or 12:33:20 AM

Time values are a portion of a date value and represented by a decimal number (for example, 12:00 PM is represented as 0.5 because it is half of a day).

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Источник

Add or subtract time

Let’s say that you need to add two different time values together to get a total. Or, you need to subtract one time value from another to get the total time spent working on a project.

As you’ll see in the sections below, Excel makes it easy to add or subtract time.

Add time

Suppose that you want to know how many hours and minutes it will take to complete two tasks. You estimate that the first task will take 6 hours and 45 minutes and the second task will take 9 hours and 30 minutes.

Here is one way to set this up in the a worksheet.

Enter 6:45 in cell B2, and enter 9 :30 in cell B3.

In cell B4, enter =B2+B3 and then press Enter.

The result is 16:15—16 hours and 15 minutes—for the completion the two tasks.

Tip: You can also add up times by using the AutoSum function to sum numbers. Select cell B4, and then on the Home tab, choose AutoSum. The formula will look like this: =SUM(B2:B3). Press Enter to get the same result, 16 hours and 15 minutes.

Well, that was easy enough, but there’s an extra step if your hours add up to more than 24. You need to apply a special format to the formula result.

To add up more than 24 hours:

In cell B2 type 12:45, and in cell B3 type 15:30.

Type =B2+B3 in cell B4, and then press Enter.

The result is 4:15, which is not what you might expect. This is because the time for Task 2 is in 24-hour time. 15:30 is the same as 3:30.

To display the time as more than 24 hours, select cell B4.

On the Home tab, in the Cells group, choose Format, and then choose Format Cells.

In the Format Cells box, choose Custom in the Category list.

In the Type box, at the top of the list of formats, type [h]:mm;@ and then choose OK.

Take note of the colon after [h] and a semicolon after mm.

The result is 28 hours and 15 minutes. The format will be in the Type list the next time you need it.

Subtract time

Here’s another example: Let’s say that you and your friends know both your start and end times at a volunteer project, and want to know how much time you spent in total.

Follow these steps to get the elapsed time—which is the difference between two times.

In cell B2, enter the start time and include “ a” for AM or “ p” for PM. Then press Enter.

In cell C2, enter the end time, including “ a” or “ p” as appropriate, and then press Enter.

Type the other start and end times for your friends, Joy and Leslie.

In cell D2, subtract the end time from the start time by entering the formula =C2-B2, and then press Enter.

In the Format Cells box, click Custom in the Category list.

In the Type list, click h:mm (for hours and minutes), and then click OK.

Now we see that Richard worked 3 hours and 45 minutes.

To get the results for Joy and Leslie, copy the formula by selecting cell D2 and dragging to cell D4.

The formatting in cell D2 is copied along with the formula.

To subtract time that’s more than 24 hours:

It is necessary to create a formula to subtract the difference between two times that total more than 24 hours.

Follow the steps below:

Referring to the above example, select cell B1 and drag to cell B2 so that you can apply the format to both cells at the same time.

In the Format Cells box, click Custom in the Category list.

In the Type box, at the top of the list of formats, type m/d/yyyy h:mm AM/PM.

Notice the empty space at the end of yyyy and at the end of mm.

The new format will be available when you need it in the Type list.

In cell B1, type the start date, including month/day/year and time using either “ a” or “ p” for AM and PM.

In cell B2, do the same for the end date.

In cell B3, type the formula =(B2-B1)*24.

The result is 31.5 hours.

Note: You can add and subtract more than 24 hours in Excel for the web but you cannot apply a custom number format.

Add time

Suppose you want to know how many hours and minutes it will take to complete two tasks. You estimate that the first task will take 6 hours and 45 minutes and the second task will take 9 hours and 30 minutes.

In cell B2 type 6:45, and in cell B3 type 9:30.

Type =B2+B3 in cell B4, and then press Enter.

It will take 16 hours and 15 minutes to complete the two tasks.

Tip: You can also add up times using AutoSum. Click in cell B4. Then click Home > AutoSum. The formula will look like this: =SUM(B2:B3). Press Enter to get the result, 16 hours and 15 minutes.

Subtract time

Say you and your friends know your start and end times at a volunteer project, and want to know how much time you spent. In other words, you want the elapsed time or the difference between two times.

In cell B2 type the start time, enter a space, and then type “ a” for AM or “ p” for PM, and press Enter. In cell C2, type the end time, including “ a” or “ p” as appropriate, and press Enter. Type the other start and end times for your friends Joy and Leslie.

In cell D2, subtract the end time from the start time by typing the formula: =C2-B2, and then pressing Enter. Now we see that Richard worked 3 hours and 45 minutes.

To get the results for Joy and Leslie, copy the formula by clicking in cell D2 and dragging to cell D4. The formatting in cell D2 is copied along with the formula.

Источник

Date and time functions (reference)

To get detailed information about a function, click its name in the first column.

Note: Version markers indicate the version of Excel a function was introduced. These functions aren’t available in earlier versions. For example, a version marker of 2013 indicates that this function is available in Excel 2013 and all later versions.

Returns the serial number of a particular date

Calculates the number of days, months, or years between two dates. This function is useful in formulas where you need to calculate an age.

Converts a date in the form of text to a serial number

Converts a serial number to a day of the month

DAYS function

Returns the number of days between two dates

Calculates the number of days between two dates based on a 360-day year

Returns the serial number of the date that is the indicated number of months before or after the start date

Returns the serial number of the last day of the month before or after a specified number of months

Converts a serial number to an hour

ISOWEEKNUM function

Returns the number of the ISO week number of the year for a given date

Converts a serial number to a minute

Converts a serial number to a month

Returns the number of whole workdays between two dates

NETWORKDAYS.INTL function

Returns the number of whole workdays between two dates using parameters to indicate which and how many days are weekend days

Returns the serial number of the current date and time

Converts a serial number to a second

Returns the serial number of a particular time

Converts a time in the form of text to a serial number

Returns the serial number of today’s date

Converts a serial number to a day of the week

Converts a serial number to a number representing where the week falls numerically with a year

Returns the serial number of the date before or after a specified number of workdays

WORKDAY.INTL function

Returns the serial number of the date before or after a specified number of workdays using parameters to indicate which and how many days are weekend days

Converts a serial number to a year

Returns the year fraction representing the number of whole days between start_date and end_date

Important: The calculated results of formulas and some Excel worksheet functions may differ slightly between a Windows PC using x86 or x86-64 architecture and a Windows RT PC using ARM architecture. Learn more about the differences.

Источник

TIMEVALUE Function – Text to Time in Excel, VBA, G Sheets

Download the example workbook

This tutorial demonstrates how to use the Excel TIMEVALUE Function in Excel to convert a time stored as text into a valid time.

TIMEVALUE Function Overview

The TIMEVALUE Function Converts a time stored as text into the time’s corresponding serial number.

To use the TIMEVALUE Excel Worksheet Function, select a cell and type:

(Notice how the formula inputs appear)

TIMEVALUE Function Syntax and Inputs:

Function Arguments ( Inputs ):

time_text – The time stored as text. Example “6:00:00”

TIMEVALUE Examples

Convert Time Stored as Text to Time

When working in spreadsheets you might encounter time stored as text. You can usually identify times stored as text because the times are left-aligned and are proceeded by apostrophes:

These “times” are treated as text and you’ll be unable to work with them like normal times.

One way to convert the text to a date is with the TIMEVALUE Function:

Things to know about the TIMEVALUE Function:

  • TIMEVALUE ignores date information. To convert a date+time stored as text to a number, use the VALUE Function instead. Or use the DATEVALUE function to get the date only.

TIMEVALUE in Google Sheets

The TIMEVALUE Function works exactly the same in Google Sheets as in Excel:

TIMEVALUE Examples in VBA

You can also use the TIMEVALUE function in VBA. Type:

Running the following VBA statements

will create the following output

For the function arguments (time_text, etc.), you can either enter them directly into the function, or define variables to use instead.

Источник

TIME Excel Function

TIME Formula in Excel

TIME is a time worksheet function in Excel that is used to make time from the arguments provided by the user. The arguments are in the following format: hours, minutes, and seconds. The range for the input for hours can be from 0-23, and for minutes it is 0-59 and similar for seconds. The method to use this function is as follows: =Time( Hours, Minutes, Seconds).

For example, TIME(0,0,3500) = 0.04050925 or 12:58:20 AM.

Table of contents

Explanation

The formula of TIME accepts the following parameters and arguments:

  • hour – This can be any number between 0 and 32767, representing the hour. The point to be noted for this argument is that if the hour value is larger than 23, it will then be divided by 24. The remainder of the division will be used as the hour value. For better understanding, TIME(24,0,0) will be equal to TIME(0,0,0), TIME (25,0,0) means TIME(1,0,0) and TIME(26,0,0) will be equal to TIME(2,0,0) and so on.
  • minute – This can be any number between 0 and 32767, representing the minute. For this argument, you should note that if the minute value is larger than 59, every 60 minutes will add up to 1 hour in the pre-existing hour value. For better understanding, TIME(0,60,0) will be equal to TIME(1,0,0) and TIME(0,120,0) will be equal to TIME(2,0,0) and so on.
  • second – This can be any number between 0 and 32767, representing the second. For this argument, you should note that if the second value exceeds 59, then every 60 seconds will be added 1 minute to the pre-existing minute value. For better understanding, TIME(0,0,60) will be equal to TIME(0,1,0) and TIME(0,0,120) will be equal to TIME(0,2,0) and so on.

Return Value of TIME Formula:

The return value will be a numeric value between 0 and 0.999988426, which represents a particular timesheet.

Usage Notes

  • The TIME in the Excel sheet is used for creating a date in serial number format from the hour, minute, and seconds components, which you specify.
  • The TIME sheet creates a correct time if you have the values of the above components separately. For example, TIME(3,0,0,) is equal to 3 hours, TIME(0,3,0) is equal to 3 minutes, TIME (0,0,3) is equal to 3 seconds, and TIME(8,30,0) is equal to 8.5 hours.
  • Once you get the right time, you can easily format it as per your requirements.

How to Open the TIME Function in Excel?

    You can enter the desired TIME formula in the required cell to attain a return value on the argument.

You can manually open the TIME formula dialogue box in the spreadsheet and enter the logical values to attain a return value.

Consider the screenshot below to see the formula of the TIME option under the DATE and TIME function in the Excel menu.

How to Use TIME in Excel Sheet?

The above screenshot shows that three columns have been included: D, E, and F. These columns have different formats that offer the results generated from the TIME function. Consider the following points for better understanding.

  • The column D cells are formatted with the “General” format to display the result from the TIME function in decimal values.
  • The column E cells are formatted with the default h:mm AM/PM format. It is how Excel automatically formats the results once you enter the TIME formula.
  • The column F cells are formatted with h:mm:ss AM/PM custom format. It will help you see the full hours, minutes, and seconds.

Based on the above Excel spreadsheet, let us consider eight examples and see the TIME function return based on the syntax.

Note- To attain the result, you must enter the TIME formula in all three columns, D, E, and F cells.

Consider the screenshots of the above examples for a clear understanding.

Example #1

Example #2

Example #3

Example #4

Example #5

Example #6

Example #7

Example #8

Excel TIME Function Errors

If you get any error from the TIME function, it can be one of the following.

#NUM! – This kind of error occurs if the argument provided by you is evaluating a negative time; for example, if the supplied hour is less than 0.

#VALUE! – This kind of error occurs if any of the arguments are supplied by you in non-numeric.

Things to Remember

  • The TIME function in Excel allows you to create time with individual hour, minute, and second components.
  • The TIME in Excel is categorized under the DATE and TIME functions.
  • The TIME function will return a decimal value between 0 and 0.999988426, giving an hour, minute, and second value.
  • After using the TIME on Excel, once you get the right time, we can easily format it as per the requirements.

TIME Function in Excel Video

Recommended Articles

This article has been a guide to TIME Function in Excel. Here, we discuss the TIME formula in Excel and how to use the TIME function, along with Excel examples and downloadable Excel templates. You may also look at these useful functions in Excel: –

Источник

Понравилась статья? Поделить с друзьями:
  • Excel time from time and date
  • Excel time from seconds
  • Excel time code to date
  • Excel time between dates
  • Excel this row number