Hello! I’ve been puzzling over how to subtract dates within a group of records when the groups are unequal sizes.
I have data that is grouped by person, identified by an ID number. That is, each person has multiple records, or lines in the table, and their ID number is the same in each one. The number of lines that each person has varies. Each line represents a service event, and within each line is the date of service. I would like to calculate how long each person has been in service by subtracting the latest service date from the earliest service date.
I know how to do pieces of this problem, but not together. If I were summing or counting the data, I could simply use a pivot table, but I don’t see how to do date subtraction in a pivot table. And I know how to do date subtraction and the max and min function, but not when the data is grouped like this. (I was searching for some sort of group or by function in Excel but could only find information on subtotaling.)
Any hints or assistance would be appreciated. Thank you!
I have data that is grouped by person, identified by an ID number. That is, each person has multiple records, or lines in the table, and their ID number is the same in each one. The number of lines that each person has varies. Each line represents a service event, and within each line is the date of service. I would like to calculate how long each person has been in service by subtracting the latest service date from the earliest service date.
I know how to do pieces of this problem, but not together. If I were summing or counting the data, I could simply use a pivot table, but I don’t see how to do date subtraction in a pivot table. And I know how to do date subtraction and the max and min function, but not when the data is grouped like this. (I was searching for some sort of group or by function in Excel but could only find information on subtotaling.)
Any hints or assistance would be appreciated. Thank you!