Forum Discussion
Looking at 2 Date Columns and Using Earliest Time
I am looking for help with a formula that will look at two date/time columns and use the earlier time.
For example, when calculating the length of stay, it is currently only using the registration date/time (because ideally this is earlier than triage date/time, but not always the case) and caluculating with the discharge date/time to produce the length of stay.
I now want the formula to consider the Triage Date/Time and the Registration Date/Time and decipher which date/time is earlier and use that to then calculate the length of stay of the patient. Is this possible?
Here is a screenshot of some sample data:
Thanks in advance!
2 Replies
- rsbinCommunity Champion
This SWITCH Statement should get you there:
LengthofStay = SWITCH(TRUE(),
[Registration Date/Time] < [Triage Date/Time], [Discharge Date/Time] - [Registration Date/Time],
[Discharge Date/Time] - [Triage Date/Time] ).Basically an If statement to determine which is earlier.
Hope this helps.
Regards,
- ryan_mayuSuper User
could you pls provide some sample data (not the screenshot)? and what's the expected output based on the sample data you provided?