HomeGoogle DocsSpreadsheetHow to Compare Time Stamp with Normal Date in Google Sheets

How to Compare Time Stamp with Normal Date in Google Sheets

Published on

Google Sheets form responses contain time-stamp. Also, some people use a script to input time stamp in Google Sheets. Here I am not talking about that. My question here is how to compare a time-stamp with a normal date in Google Sheets as one is pure date and the other is a date with time. So the values are entirely different for a logical IF test.

I mean a time stamp “31/12/2017 20:46:10” is not equal to “31/12/2017”. So a logical test may return unexpected results.

When you want to perform a logical test in a cell or array containing time-stamp, you should know how to remove the time from a time-stamp. Then you can use this clean date within the logical test.

You can adopt different methods to clean time from time stamps and return the only date. I’ve already detailed it.

Must Read: How to Extract Date From Time Stamp in Google Sheets

Hope you have checked the above Google Sheets tutorial. Now back to our topic and example.

Example to Compare Time Stamp with Normal Date in Google Sheets

Google Sheets Example to Compare Time Stamp with Normal Date

In this screenshot, you can clearly see that Column A contains time-stamps. I have an array formula in B1 which checks the time-stamps in Column A. The logical test is like this.

You May Like: Learn all date functions in Google Sheets

If column A date is greater than “20-01-2018”, the formula should return “Late Submission” else “Accepted”.

Now I am bringing your attention to the below two formulas. The first one is the original formula which I’ve used to compare the time-stamp with the normal date in Google Sheets. See this formula in the above screenshot.

Formula 1.

=ArrayFormula(if(len(A1:A),(if(int(A1:A)>date(2018,1,20),"Late Submission","Accepted")),""))

In this formula, I’ve converted the time stamp in Column A to normal date with the help of the INT function.

If you use the below formula, which is a normal logical test, it would return a wrong result in row 2 as it treats the time stamp “20/01/2018 19:30:22” in row 2 and date “20/01/2018” as two different values.

Must Check: Google Sheets all time-related functions in one place

Formula 2.

=ArrayFormula(if(len(A1:A),(if(A1:A>date(2018,1,20),"Late Submission","Accepted")),"")

If you are unfamiliar with using any of the functions used in the above example, feel free to check my Google Sheets Functions guide to pick the functions that you want to learn. That’s all.

This way you can compare time-stamp with a normal date 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.

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

Customizing Alternating Colors of a Table in Google Sheets

Google Sheets' new table feature offers limited options for customizing colors. While you can...

Structured Table References in Formulas in Google Sheets

When you create a Google Sheets table by inserting custom tables or converting a...

More like this

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

Customizing Alternating Colors of a Table in Google Sheets

Google Sheets' new table feature offers limited options for customizing colors. While you can...

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.