Forum Discussion
ajcameron1929
Jul 08, 2020Copper Contributor
DATEDIF
I am using DATEDIF function to calculate an age of person in years at a specific date. Formula example: =DATEDIF(F2,"09/01/2020","y"). In my s/s, cell F2 is their birthday and reads: 24-Feb-03. The ...
mathetes
Jul 08, 2020Silver Contributor
I haven't been able to replicate the problem in my Excel. What does occur to me is that your system may be comparing one true date value with a text that looks date-like.
What I'd recommend, in any event, instead of hard-coding the DATEDIF function with the date for which you want the age, put that in cell E2. Then, making sure that both E2 and F2 contain dates properly formatted, use the formula =DATEDIF(F2,E2,"y")
It's generally better not to hard-code variables into formulas; makes them far less flexible.
What I'd recommend, in any event, instead of hard-coding the DATEDIF function with the date for which you want the age, put that in cell E2. Then, making sure that both E2 and F2 contain dates properly formatted, use the formula =DATEDIF(F2,E2,"y")
It's generally better not to hard-code variables into formulas; makes them far less flexible.