Both the solutions given here work well. I have data that is similar, but in a date format. I want to calculate the difference between rows where the differences are in units such as 'day' or 'year' or 'week' or 'months'. Is there a way to do this?
Look into the Scripting Index for the function