HomeGoogle DocsSpreadsheetHow to Check Time Input in a Range of Cells in Google...

How to Check Time Input in a Range of Cells in Google Sheets

Published on

To check time input in a range of cells or a single cell you can use the TIMEVALUE function in Google Sheets. If it’s a range of cells the formula should be entered as an Array Formula.

We can use either of the functions ISBLANK or LEN to test whether a cell contains a value. Both will work in a range of cells (array) also.

While the former returns TRUE or FALSE Boolean values the latter returns 0 for blank and the number of characters for non-blanks.

But none of them is useful to test whether the cell not only contains a value but also that value is time.

ISBLANK and LEN in a time range

With TIMEVALUE function we can check time input in a range of cells in Google Sheets.

How to Check Time Input in a Range of Cells Using TIMEVALUE

Let’s start with a single cell.

test time input in Sheets

As you can see the TIMEVALUE formula returns #VALUE! error when the value in cell A1 changes to the text string or number. It only works with date and time.

If the value is a date, the TIMEVALUE formula would return 0. For time input, no doubt, the formula would return the value of that time.

We can use TIMEVALUE in an IF statement as below.

=if(timevalue(A1)>0,TRUE,FALSE)

The above formula would only return TRUE, when the value in cell A1 is a time. For a date input, it would return FALSE. Else for text and number entry, the formula would definitely return the VALUE! error.

Formula to Check Time Input in a Range of Cells in Google Sheets

Here is a real-life example to the use of checking time input in a range of cells in Google Sheets.

Suppose cell A2 contains the start time and B2 contains end time. I want to only do the below calculation if both the cells contain time inputs.

=B2-A2

Here is the formula that tests both the cells for time inputs and perform the above calculation.

=ArrayFormula(IF(COUNT(TIMEVALUE({A2,B2}))=2,B2-A2,""))

Logic:

The count of cell A2 and B2 will be 2 if both the values are time. Else return 1 or 0.

=ArrayFormula(COUNT(TIMEVALUE({A2,B2})))

That’s all. Hope you have enjoyed the stay!

Additional Resources:

  1. How to Filter Timestamp in Query in Google Sheets.
  2. Google Sheets: The Best Overtime Calculation Formula.
  3. COUNTIFS in a Time Range in Google Sheets [Date and Time Column].
  4. How to Convert Military Time in Google Sheets.
  5. Elapsed Days and Time Between Two Dates in Google Sheets.
Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Excel Template for Hourly Time Slot Booking

Our free Excel template for hourly time slot booking helps you view 24/7 booking...

Excel: Hotel Room Availability and Booking Template (Free)

Presenting a free Excel template with advanced features for hoteliers to check room availability...

Dynamic Sum Column in SUMIF in Google Sheets

To obtain a dynamic sum column (sum_range argument) in SUMIF, we can utilize the...

Create a Calendar in Excel with a One-Line Dynamic Array Formula

This tutorial explains how to create a calendar in Excel using a one-line formula...

More like this

Dynamic Sum Column in SUMIF in Google Sheets

To obtain a dynamic sum column (sum_range argument) in SUMIF, we can utilize the...

Get the First or Last Row/Column in a New Google Sheets Table

If you've recently started using the new Google Sheets TABLE functionality, you may find...

UNIQUE Function in Visible Rows in Google Sheets

The UNIQUE function doesn't inherently include only visible rows when it returns values, discarding...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.