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

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on November 6, 2023
Download Example Workbook

Download the example workbook

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

TIMEVALUE Main Function

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:

TIMEVALUE TIME Format

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)

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 Google Sheet

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

Vba TIMEVALUE function

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

AI Formula Generator

Try for Free

Excel Practice Worksheet

practice excel worksheet

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

  • Automatically Graded Exercises
  • Learn Excel, Inside Excel!

Free Download

Return to List of Excel Functions