# How to Use an IF Function with Dates in Excel

In this tutorial, you will learn how to use the IF function in Excel.

One of the most used functions in Excel is the IF function, which enables you to compare values logically to expectations. Thus, an IF statement can produce two outcomes. If your comparison is True, the first result is what you get; if it’s False, the second.

Once ready, we’ll get started by utilizing real-world examples to show you how to use the IF function in Excel.

## IF Function Formula

IF(logical_test, value_if_true, [value_if_false])

Use the IF function to return one value if a condition is true and another value if it’s false.

## Use the IF function in Excel

Before we begin we will need a group of data to be used to use the IF function in Excel.

### Step 1

First, you need to have a clean and tidy group of data to work with.

### Step 2

In this example, we want to find out which dates are before 30 January 2023. To do so we will use this formula =IF(A2<DATEVALUE(“30/01/2023″),”Yes”,”No”).

### Step 3

Once you press Enter, your formula will return which dates are before or after 30 January 2023.