In this article, I am going to teach you how you can easily compare two dates in Google Sheets!
Hello, there! Welcome to another guide made by TeqTog especially for you!
Let’s get right to it, then!
Comparing dates in Google Sheets is actually just the use of the IF function available in the Google Sheets.
If you want to check out TeqTog’s article on how to use IF statements, then be sure to read and all the other useful content!
Methods of Comparing Two Dates in Google Sheets
Basically, there are five different ways in which you can compare between two date values. And they are:
- Equal to
- Greater than
- Less than
- Not equal to each other, and
- Finding out which is the latest date.
Let me show you an example, where I have a series of dates.
So, if I use the IF function for these values, then I can easily see which date is the latest one, which two dates are equal, or not equal and, which dates are lower or greater between the two of them.
Now, suppose I want to see if the dates given in column A is greater (more recent) than the dates given in column B.
So first, I will select a cell where I want to see the answers and then, insert the following formula for the IF function:
The syntax of this formula is easy.
The first element is the logical expression. The logical expression is the condition which I want to check; in this case, I want to see if the value in A2 is greater than the value in B2. Next, if that condition is met, I want to my spreadsheet to show me “Yes” and if it turns out to be false, I want it to show me “No”. This way, I can easily understand.
As you can see, I have inserted the formula in the greater than the column. If I press “Enter” and copy and paste the same formula into the rest of the cell, I will get the results.
In addition, I can have this exact same process done for all of the other comparisons as well.
- For checking to see if the value in A2 is lower, the formula was =IF(A2<B2,”yes”,”no”)
- To see if the dates were equal to each other, I gave “A2=B2” for the logical expression. And,
- To see whether the dates do not match with each other, I inserted “A2<>B2” in the logical expression.
Now, you need to remember that this formula will only work on these values; if they are in the same format. This means, that all of the dates need to be in the date format.
To do this, you can select all of the dates and go to “Format” on the top menu and find “Number”. From the second drop-down menu, just click on “Date”.
Fining the Latest Date
You can play around with the IF function to find out which dates are the latest.
All you need to do is, create the multiple IF function by typing “=IFS” and insert the “greater than” and “less than” conditions and, after each condition gives the return value that you want to see.
For instance, if the first date is lower, then the latest date would be the “second date” or “Column B”. And, so on.
So, that is for this article and I hope it will help you the next time you want to compare two dates in Google Sheets.
Best of luck!
Read More Guide Tutorials On: