Sep 08 2023 10:48 AM
Hello,
I needed a formula that would return a yes or no result by row in column A, if the dates in column that correspond with the patient IDs in column C are within 30 days of each other. some background, column C is patient ID, there are at least 2 or more of each and within those I need to see if the dates that correspond to those Patient IDs are within 30 days of each other.
Thank you
Sep 08 2023 10:53 AM
Isn't this the same question as in this discussion?
Formula for excel - Microsoft Community Hub
If it's different can you add the expected results in your screenshot? Thank you.
Sep 08 2023 11:54 AM
Sep 08 2023 12:25 PM
Sep 08 2023 01:06 PM
Sep 08 2023 01:42 PM
As variant
=LET(dates, SORT(FILTER([DtCreate],[PatientId]=[@PatientId])),
IF( ROWS(dates) = 1, "One date",
IF( MIN( DROP(dates,1) - DROP(dates, -1) ) < 30,
"Yes", "No" ) ) )
Sep 08 2023 01:53 PM
My rendition:
=LET(
GetDates, LAMBDA(row,
LET(
dates, FILTER(DtCreate, PatientID = row, 0),
diff, DROP(dates, 1) - DROP(dates, -1),
IFERROR(IF(MIN(diff) <= 28, "Yes", ""), "")
)
),
BYROW(PatientID, GetDates)
)