# If Then Statement with Dates and Vlookup

#### cmschmitz24

##### Board Regular
I have a date being vlookup'd into column H from a different spreadsheet and then I need to determine if that date is greater than or less than 04/01/21 in column J. If it's older than 04/01/21, I need to have column J return 04/01/21. If it's newer than 04/01/21 then I need to have column J return the date vlookup'd into column H. My formulas are not calculating correctly. Please help.

The formula I have in column J is: =IF(H2>DATEVALUE("04/01/2021"),H2,"04/01/2021")

However, it works for the first row, the next rows are not returning the correct date wanted. Here's an example of what I'm getting -

row 2, column J should return 06/01/2021
rows 3-5, column J should return 04/01/2021

#### cmschmitz24

##### Board Regular
Thank you! Changing the master data to dates worked.

### Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

#### Fluff

##### MrExcel MVP, Moderator
You're welcome & thanks for the feedback.

Replies
4
Views
204
Replies
1
Views
238
Replies
3
Views
189
Replies
2
Views
273
Replies
2
Views
221

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

1,151,589
Messages
5,765,314
Members
425,272
Latest member
Umba

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back