Oct 13 2022 11:48 AM
Want to use yearfrac instead of datedif and it works but we want to have it give a value of 0 if one of the dates is in the future. I want to figure out how long someone has worked for us based on todays date and their start date.
Oct 13 2022 12:01 PM
SolutionLet's say you have dates in D2 and E2.
=IF(OR(D2:E2>TODAY()),0,YEARFRAC(D2,E2))
This can be filled down.
If you want to compare D2 to today's date:
=IF(D2>TODAY(),0,YEARFRAC(D2,TODAY()))
Oct 13 2022 12:06 PM
Oct 19 2022 12:51 AM
@Hans Vogelaar seems my colleague is happy with your solution. Thank you
Oct 19 2022 01:08 AM
Good to hear that. Thanks for the feedback.
Oct 13 2022 12:01 PM
SolutionLet's say you have dates in D2 and E2.
=IF(OR(D2:E2>TODAY()),0,YEARFRAC(D2,E2))
This can be filled down.
If you want to compare D2 to today's date:
=IF(D2>TODAY(),0,YEARFRAC(D2,TODAY()))