I have this data set. Columns 1,2,3 and 4. I want to subtract time between consequent transactions only when I see transaction type "A1" . First it should check whether for same ID, indicator has changed. If it has, then I want subtraction between A1 of indicator 1 and A1 of Indicator 2.
If indicator has not changed then look at ID and see if that has changed. If it has, then find the immediate next A1 and subtract the times.
I want to display result in a new column as shown above (in minutes).