Detention Pay (Waiting Time)

Excel Formulas › Logistics & Trucking

All versionsMAX

When a shipper holds a truck past the free time (usually 2 hours), detention is owed for the extra hours at an hourly rate — often capped per day. It compensates for lost driving time.


Quick formula: detention pay past free time:
=MAX(hours_waited - free_hours, 0) * hourly_rate
Subtract the free hours, floor at zero, and multiply the billable hours by the detention rate.

Functions used (tap for the full reference guide):

The example

5 hrs waited, 2 free, $60/hr.

AB
1ItemValue
25 − 23 hrs
3× $60→ $180

The formula

The formula:

=MAX(hours_waited - free_hours, 0) * hourly_rate // billable wait hours × rate

How it works

How it works:

  1. Subtract the free time from hours waited; MAX(…, 0) floors it at zero.
  2. Multiply billable hours by the detention hourly rate.
  3. Apply a daily cap with MIN(pay, daily_cap) if the contract sets one.
  4. Accurate arrival/departure timestamps are what make a detention claim stick.

Detention is only as good as your timestamps. The pay math is trivial — billable hours past free time, times the rate — but collecting it depends on documented check-in and check-out times the shipper can’t dispute. Round to the contract’s increment, apply any daily cap, and keep the arrival/departure record (ELD, gate logs) so the claim holds up. The formula is easy; the proof is the work.

Try it: interactive demo

Live demo

Hours waited, free hours, hourly rate.

Detention:

Variations

With a daily cap

Limit the pay:

=MIN(MAX(waited-free,0)*rate, daily_cap)

Billable hours

Past free time:

=MAX(hours_waited - free_hours, 0)

Hours from timestamps

Departure − arrival:

=(departure - arrival) * 24

Pitfalls & errors

Floor at zero. Within free time, detention is $0 — MAX.

Daily cap. Apply MIN if the contract caps detention per day.

Document times. Detention claims need solid arrival/departure records.

Practice workbook

📊
Download the free Detention Pay (Waiting Time) practice workbook
A detention sheet with the daily-cap, billable-hours, and timestamp variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I calculate detention pay in Excel?
Billable hours past free time times the rate: =MAX(hours_waited - free_hours, 0) * hourly_rate. 3 billable hours at $60 is $180.
How do I apply a daily cap?
Wrap with MIN: =MIN(MAX(waited-free,0)*rate, daily_cap).
How do I get the hours from timestamps?
Multiply the time difference by 24: =(departure - arrival) * 24.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: On-time delivery rate · Time difference · Hours-of-service remaining

Function references: MAX