filmfanatic1970
New Member
- Joined
- Mar 11, 2022
- Messages
- 5
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
I'm not sure if this can be done, but I am trying to get the day difference between two dates. The catch is that I'm looking to match multiple text in the first column and then run a day difference function for the first two matches...and then the next two matches, etc. through the entire sheet.
There are three variables in column A: P1, P2 and P3.
In the example below, I want to match the first P3 and then the next. Then, grab the two dates for the first match in column C and run a day difference function (In D5, I put =DAYS(D5,D3), because A5 and A3 match. It comes up with 2.0. Then I want to match the next P3, after the one in A5, which is A9. The day difference is shown as 5.0.
I'm trying to do the same thing for all P1, P2 and P3 matches, all the way down column A. Going forward, as an example, if I were to type in a P2 in A13 and put a date in column C, then it would match with the previous P2 in A8 and calculate the day difference between row 8 and row 13.
I don't think this can be done with traditional formulas and was thinking it needs to be done with VBA.
I hope this makes sense.
There are three variables in column A: P1, P2 and P3.
In the example below, I want to match the first P3 and then the next. Then, grab the two dates for the first match in column C and run a day difference function (In D5, I put =DAYS(D5,D3), because A5 and A3 match. It comes up with 2.0. Then I want to match the next P3, after the one in A5, which is A9. The day difference is shown as 5.0.
I'm trying to do the same thing for all P1, P2 and P3 matches, all the way down column A. Going forward, as an example, if I were to type in a P2 in A13 and put a date in column C, then it would match with the previous P2 in A8 and calculate the day difference between row 8 and row 13.
I don't think this can be done with traditional formulas and was thinking it needs to be done with VBA.
I hope this makes sense.