# MS Excel: TIMEVALUE Function (WS, VBA)

This Excel tutorial explains how to use the Excel TIMEVALUE function with syntax and examples.

## Description

The Microsoft Excel TIMEVALUE function returns the serial number of a time.

## Syntax

The syntax for the Microsoft Excel TIMEVALUE function is:

`TIMEVALUE( time_value )`

### Parameters or Arguments

time_value is a string representation of a time. This can not be a date/time value (it MUST be a string).

## Applies To

The TIMEVALUE function can be used in the following versions of Microsoft Excel:

• Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000

## Type of Excel Function

The TIMEVALUE function can be used in Microsoft Excel as the following type of function:

• Worksheet function (WS)
• VBA function (VBA)

## Example (as Worksheet Function)

Let's look at some Excel TIMEVALUE function examples and explore how to use the TIMEVALUE function as a worksheet function in Microsoft Excel:

Based on the spreadsheet above, the following Excel TIMEVALUE function would return the following values:

```=TIMEVALUE(A1)
Result: 0.584733796

=TIMEVALUE(A2)
Result: 0.084733796

=TIMEVALUE(A3)
Result: 0.646261574

=TIMEVALUE("5:12:00 AM")
Result: 0.216666667```

## Example (as VBA Function)

The TIMEVALUE function can also be used in VBA code in Microsoft Excel.

Let's look at some Excel TIMEVALUE function examples and explore how to use the TIMEVALUE function in Excel VBA code:

```Dim LTime As Date

LTime = TimeValue("18:30:12")```

In this example, the variable called LTime would now contain the value of 6:30:12 PM.

Share: