How to use the TIMEVALUE function
What is the TIMEVALUE function?
The TIMEVALUE function returns a decimal number representing an Excel time value, based on a text string. Excel uses decimal numbers between 0 and 0.99988426 formatted as time. 0 (zero) is 12:00:00 AM and 0.99988426 is 11:59:59 P.M.
The TIMEVALUE function in Excel is rarely needed to convert values in formulas. Excel automatically handles conversion of numbers, text, logical values, and error values as required. TIMEVALUE function is provided for compatibility with other spreadsheet applications. In most cases, Excel will format values correctly without requiring the TIMEVALUE function function.
Only use TIMEVALUE function if you find Excel is not properly converting a value to text in a specific formula. In general, you can avoid using it entirely since Excel auto-converts types seamlessly in most situations.
What is an Excel time value?
Excel time is actually a decimal number ranging between 0 and 1 in Excel and then formatted as time.
For example, 12:00 PM is represented as 0.5 because it is half of a day, you can verify this by typing 12:00 PM in a cell and then change the cell formatting to general. This will show the value as Excel interprets it.
Does the TIMEVALUE function ignore dates?
Yes, the TIMEVALUE function ignores the date part , example "22-Aug-2019 6:35 PM" returns 0.774305556 which is equal to "6:35 PM".
How does Excel recognize time values?
Excel recognizes certain text strings like "6:45 PM" as valid time values. A recognized time value is right aligned in the cell just like a regular number, shown in the image below in cell B2.
A time number that is not recognized is left aligned which is demonstrated in cell B4 in the image above. This visual feedback lets you easily spot values that need closer inspection.
How to show the decimal value as an Excel time value?
- Select the cell containing the decimal value.
- Press CTRL + 1 to open the "Format Cells" dialog box shown in the image above.
- Select category "Time".
- Select a type.
- Press with left mouse button on the "OK" button.
Why convert time values to decimal numbers?
The conversion allows you to perform arithmetic operations to time values, this works only if the time value is represented as a numerical value.
This lets you add or subtract, for instance, hours, minutes, and seconds easily using simple Excel formulas. It also lets you perform average, median, and other calculations using specific Excel functions.
TIMEVALUE function Syntax
TIMEVALUE(time_text)
TIMEVALUE function Arguments
time_text | Required. A text string within quotation marks that represent time, for example "03:23 PM" or "22:21". |
TIMEVALUE function example
The image above demonstrates the TIMEVALUE function in cells B3 to B8, it converts time values as text values to decimal numbers.
Formula in cell B3:
The decimal numbers shown in cells B3 to B8 are the actual Excel time representation of:
- 1:48 AM
- 6:11 PM
- 9:58 AM
- 11:59:59 PM
- 0:00 AM
- 12:00 PM
Functions in 'Date and Time' category
The TIMEVALUE function function is one of 22 functions in the 'Date and Time' category.
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form