Access Calculation - Subtract Index(t) from Index (t-1)

Demab

New Member
Joined
Dec 3, 2004
Messages
7
Okay, I have an access database with data in rows containing names and times of arrival for multiple sets (shows). If the set id is the same, I need to subtract the time field from the previous time field (to get interarrival times), and if not, I want to leave it blank. I know this is an easy formula in Excel, but does anyone know how to write it in SQL for Access?

Excel Code: IF(SetID4=SetID5, Time5-Time4, " ")

Thanks!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hi, you should be able to do this with a combination of a ranking query and a dlookup function - the ranking query puts the records into the correct sequence and the dlookup function can refer to the previous line in the query. I haven't tested it but these links should help :
Ranking Records in a Query
Using DLookup
MrExcel thread that might help - see the 4th post
HTH, Andrew. :)
 
Upvote 0

Forum statistics

Threads
1,221,889
Messages
6,162,624
Members
451,778
Latest member
ragananthony7911

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top