If a date is equal to

How to test if a date is equal to another date and return a value if the test is True or False through the use of an Excel formula, with the IF function

EXCEL FORMULA 1. If a date is equal to

EXCEL

Hard coded formula
If a date is equal to
Cell reference formula
If a date is equal to
=IF(B8=$C$5,"Include","Exclude")
=IF(B10=$C$5,$C$6,$C$7)
GENERIC FORMULA

=IF(date=spec_date,value_if_true,value_if_false)

ARGUMENTS
date: A date that you want to test against another date to identify if it's equal to this date.
spec_date: A date that another date is tested against.
value_if_true: Value to be returned if the date is equal to the spec_date.
value_if_false: Value to be returned if the date is not equal to the spec_date.

GENERIC FORMULA

=IF(date=spec_date,value_if_true,value_if_false)

ARGUMENTS
date: A date that you want to test against another date to identify if it's equal to this date.
spec_date: A date that another date is tested against.
value_if_true: Value to be returned if the date is equal to the spec_date.
value_if_false: Value to be returned if the date is not equal to the spec_date.

EXPLANATION

This formula uses the IF function to test if a date is equal to another date and return a value if the test is True or False.
Click on either the Hard Coded or Cell Reference button to view the formula that has the return values directly entered into the formula or referenced to a specific cell.

In this example the formula identifies if a date is equal to another date through the use of an equals sign (=). Out of the three dates that we are testing one of them is equal to the specific date and therefore the formula will return a text value of "Include". For the dates that are not equal to the specific date the formula will return a text value of "Exclude".

RELATED TOPICS

Related Topic Description Related Topic and Description
How to test if a date is less than or equal to another date and return a value if the test is True or False
How to test if a date is greater than or equal to another date and return a value if the test is True or False

RELATED FUNCTIONS

Related Functions Description Related Functions and Description
The Excel IF function performs a test on specified conditions entered into the formula and returns a specified value if the result is TRUE or another specified value if the result is FALSE