working out days from variable dates

HellBound

New Member
Joined
Mar 8, 2017
Messages
6
Hi

I am making a spreadsheet to record patients in my clinic. I can easily work out how long a patient has been in my clinic using
=DATEDIF(K5,TODAY(),"y") &" years, "&DATEDIF(K5,TODAY(),"ym")&" months" where K5 is the date first seen in the clinic.

However, patients will eventually leave the clinic (either death or disease progression), so i will put the date of their last clinic in a different cell (say P5). At that point i want the amount of time in my clinic to stop ie stop using TODAY and use the date in P5.

Can the above formula be adapted to use P5 instead of TODAY only when a value is put in P5?

Hope this is clear.... newbie here!

HB
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
How about
=DATEDIF(K5,IF(P5="",TODAY(),P5),"y") &" years, "&DATEDIF(K5,IF(P5="",TODAY(),P5),"ym")&" months"
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Cross posted calculating amount of days

For future reference while we do allow Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
Another idea for your consideration.

T202006b.xlsm
HIJKP
4YearFracDays
51.65801 years, 6 months01-Dec-18
60.62150 years, 6 months01-Dec-1901-Jul-20
7
4b
Cell Formulas
RangeFormula
H5:H6H5=YEARFRAC(K5,IF(P5="",TODAY(),P5))
I5:I6I5=TODAY()-K5+1
J5:J6J5=DATEDIF(K5,IF(P5="",TODAY(),P5),"y") &" years, "&DATEDIF(K7,IF(P5="",TODAY(),P5),"ym")&" months"
 
Upvote 0
Sorry for the cross post, hadn't realised that was a thing, although in hind sight makes sense. Won't do it again.

Thanks to all who took the time to answer
 
Upvote 0
We don't mark threads as solved on here. ll we ask is the you post to the thread letting us know that the problem is solved.
As you've already done that, everything's fine :)
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,849
Members
449,051
Latest member
excelquestion515

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