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

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on November 6, 2023

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

## 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:

``=TIMEVALUE(B3)``

### 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.

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:

``application.worksheetfunction.timevalue(time_text)``

Running the following VBA statements

``````Range("B2") = TimeValue(Range("A2"))
Range("B3") = TimeValue(Range("A3"))``````

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.

### Excel Practice Worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!