Count number of days from date 1 (E2) to today (L1), unless there is a date 2 (F2)

Tazzbjs

New Member
Joined
Nov 2, 2011
Messages
37
I know this will be a simple one... I need to calculate the number of days from an employee's hire date (E2) to today ($L$1), unless there is an event date (F2). I would greatly appreciate any help.

Employee IDLast NameFirst NameLocationHire DateLast Preventable AccYrs without Prev AccToday
7/23/2024​
111111AaronMikeTX6/17/2015
1721757705575.png
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try:
Excel Formula:
=IF(F2>0,F2-E2,TODAY()-E2)
 
Upvote 0
Try:
Excel Formula:
=IF(F2>0,F2-E2,TODAY()-E2)
Close... The second image should be 365 days. Just needed a small change. But you got me there much faster. Thank-you

Corrected Code
Excel Formula:
=IF(F2>0,TODAY()-F2,TODAY()-E2)

1721758740607.png

1721758764356.png
 
Upvote 0
Solution
Close... The second image should be 365 days. Just needed a small change. But you got me there much faster. Thank-you

Corrected Code
Excel Formula:
=IF(F2>0,TODAY()-F2,TODAY()-E2)

View attachment 114398
View attachment 114399
Ah, well your description left the door open to interpretation, as it did not explicitly say exactly what you wanted to do when there was a date in F2:
I know this will be a simple one... I need to calculate the number of days from an employee's hire date (E2) to today ($L$1), unless there is an event date (F2).
So it was unclear whether you wanted to subtract E2 from F2 in that case, or F2 from today.

In any event, I am glad you were able to see the logic to use, and incorporate into what you needed to do.
 
Upvote 1
Corrected Code
Excel Formula:
=IF(F2>0,TODAY()-F2,TODAY()-E2)
Would this one also work for you? It assumes any date in F2 would not be before the Hire date.
Excel Formula:
=TODAY()-MAX(E2:F2)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top