SOLVED

Calculating the number of months between two dates for survival analysis

Copper Contributor

Device: Mac 

Excel product: Microsoft Excel for Mac / Version 16.53 (21091200)

I am conducting survival analysis, and I want to calculate the survival time between the start and first events. 

I found many excel functions; however, there is a mild difference in the results, i.e. Fractions. 

Here is the function I found: 

1- =DAYS(first_event_date,Start_date)/30

2- =DATEDIF(Start_date,first_event_date,"M")

3- =YEARFRAC(Start_date,first_event_date)*12

 

Here is my data; it is just one event I can apply to the rest. 

Starting date: 2005-10-14

First event date: 2007-05-30

 

Results according to the previous functions: 

1- 19.76

2- 19

3- 19.53

 

My question is, which function I should use to get the most accurate answer. 

 

Thank you,

A

 

2 Replies
best response confirmed by allyreckerman (Microsoft)
Solution

@Ahmed_Ben_2021 What is "one month"? 28, 29, 30 or 31 days. I'd say an average month equals 365/12 days. Then, the third formula seems to be the best one.

Thank you, Riny
That was very helpful
1 best response

Accepted Solutions
best response confirmed by allyreckerman (Microsoft)
Solution

@Ahmed_Ben_2021 What is "one month"? 28, 29, 30 or 31 days. I'd say an average month equals 365/12 days. Then, the third formula seems to be the best one.

View solution in original post