Forum Discussion

PhilLay's avatar
PhilLay
Copper Contributor
Mar 04, 2024
Solved

EDATE in IF statement giving wrong date

Hi,

 

I am finding when using this formula:

=IF(TODAY()>=EDATE($A3,B$2*12),EDATE($A3,B$2*12),0)

 

In the following table below, at year elapsed 27, the date outputted goes to 0/01/1900 when it should be 01/11/2024. However, when using EDATE in isolation, eg. EDATE(A3,F2*12) it executes correctly. I've tried using DATE(YEAR()+n,MONTH(),DAY()) as a substitute for EDATE and it still gives the same issue.

 

Can anyone identify what I've done wrong? Thanks!

 

 Year elapsed    
Start Date71217222732
1/11/19971/11/20041/11/20091/11/20141/11/20190/01/19000/01/1900
  • PhilLay What date did you intend to input in cell A3? January 11, 1997 or November 1, 1997? Based on the output sample provided, the date format being used is d/mm/yyyy, which means Excel is reading it as November 1, 2024. The IF function is returning 0 in this case, because TODAY() is less than November 1, 2024. When formatted as a date, 0 is represented as January 0, 1900, hence 0/01/1900 is the result (d/mm/yyyy). Try inputting 11/01/1997 in cell A3 and see if that returns the expected results. If you would prefer to input dates in Excel as mm/dd/yyyy, you will need to go into your computer's regional and language settings to configure the desired Short Date format for your system.

  • djclements's avatar
    djclements
    Bronze Contributor

    PhilLay What date did you intend to input in cell A3? January 11, 1997 or November 1, 1997? Based on the output sample provided, the date format being used is d/mm/yyyy, which means Excel is reading it as November 1, 2024. The IF function is returning 0 in this case, because TODAY() is less than November 1, 2024. When formatted as a date, 0 is represented as January 0, 1900, hence 0/01/1900 is the result (d/mm/yyyy). Try inputting 11/01/1997 in cell A3 and see if that returns the expected results. If you would prefer to input dates in Excel as mm/dd/yyyy, you will need to go into your computer's regional and language settings to configure the desired Short Date format for your system.

      • djclements's avatar
        djclements
        Bronze Contributor

        PhilLay You're welcome. Dates are a very common source of confusion in Excel, so don't beat yourself up over it. 😉 Cheers!

Resources