简体   繁体   中英

Nesting IFS statement inside DATEDIF

I am nesting an IF statement inside a DATEDIF to determine employee tenure. I am trying to write the formula in such a way that pulls the termination date if the cell is not blank, but uses today's date if the cell is blank.

Here is the formula I wrote but it is coming back with a #NAME? error.

=DATEDIF([@[Hire Date]],IFS([@[Exit Date]]<>””,[@[Exit Date]],[@[Exit Date]]="",TODAY()),"M")

You seem to have some sort of strange quotes ”” in there.

Try this.

=DATEDIF([@[Hire Date]],IF([@[Exit Date]]<>"",[@[Exit Date]],TODAY()),"M")

Note, I don't think you need the nested IF - the above formula will give the same answer as your formula, once the strange quotes are replaced of course.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM