Calculation Issues

Calculate Night Shift Hours and Premium Pay in Excel

Algirdas JasaitisAlgirdas Jasaitis Dec 2, 2026 868 views

Question details

Calculate total shift hours and the portion eligible for night premium pay when a shift may cross midnight.

Calculate Night Shift Hours and Premium Pay in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A shift can start or end outside the night premium period of 10:00 p.m. to 6:00 a.m.
Observed behavior
The goal is to identify the hours within the premium period and calculate their additional pay.
Before you start

Enter the shift start and end as Excel time values, without dates. The formulas below assume a shift shorter than 24 hours, no unpaid breaks, and a premium period from 10:00 p.m. to 6:00 a.m.

Solution 1Recommended

Calculate the Night Premium Portion of a Shift in Excel

Use time-overlap formulas for shifts that start before or after midnight.

1
Enter shift times

Enter the start time in C2 and the end time in D2, such as 4:00 PM and 3:58 AM.

2
Calculate total shift time

In E2, enter =MOD(D2-C2,1). This treats an end time earlier than the start as occurring the next day.

3
Calculate night time

In F2, enter =MAX(0,MIN(C2+MOD(D2-C2,1),TIME(6,0,0))-C2)+MAX(0,MIN(C2+MOD(D2-C2,1),1+TIME(6,0,0))-MAX(C2,TIME(22,0,0))). This adds the overlaps with the early-morning and overnight premium periods.

4
Calculate nonpremium time

In G2, enter =E2-F2. Select E2:G2, open Format Cells, and apply the custom format [h]:mm.

5
Calculate additional premium pay

Enter the additional hourly premium rate in H2. In I2, enter =F2*24*H2, then format I2 as Currency.

Calculate the Night Premium Portion of a Shift in Excel
Check the pay calculation: The result in I2 is the additional night premium only, not total wages. Deduct any unpaid breaks separately according to when they occur.
Calculate shift pay in WPS

Calculate Night Shift Premiums in WPS Spreadsheet

Use WPS Spreadsheet to calculate total shift time, isolate the 10 p.m. to 6 a.m. portion, and multiply it by the additional hourly rate.

  1. 1. Enter the shift: Open WPS Spreadsheet and enter the start time in C2 and end time in D2.
  2. 2. Calculate total time: Enter =MOD(D2-C2,1) in E2.
  3. 3. Find premium time: Enter =MAX(0,MIN(C2+MOD(D2-C2,1),TIME(6,0,0))-C2)+MAX(0,MIN(C2+MOD(D2-C2,1),1+TIME(6,0,0))-MAX(C2,TIME(22,0,0))) in F2.
  4. 4. Calculate the premium: Enter the additional hourly rate in H2 and =F2*24*H2 in I2. Use Format Cells to apply [h]:mm to E2:F2 and Currency to I2.
Calculate overnight and night-premium hours with spreadsheet formulas.Open and save Microsoft Excel XLSX files.Format durations and premium pay in a familiar spreadsheet interface.Use WPS Office for free.
microsoft office alternative - wps office

Frequently Asked Questions

How many premium hours are in a shift from 4:00 p.m. to 3:58 a.m.?

With a 10:00 p.m. to 6:00 a.m. premium period, the shift includes 5 hours and 58 minutes of premium time. Enter the times in C2 and D2 and use the night-time formula in F2.

Can the formula handle a shift that starts before 6:00 a.m.?

Yes. For example, a shift from 2:44 a.m. to noon includes 3 hours and 16 minutes in the premium period. The first part of the F2 formula calculates that early-morning overlap.

Why do I multiply the night-time result by 24?

Excel stores time as a fraction of a day. Multiplying F2 by 24 converts the duration to decimal hours before multiplying it by the hourly premium rate.

Does the formula work for a 24-hour shift?

No. With time-only entries, identical start and end times return zero through MOD. Use actual start and end dates and times for shifts of 24 hours or longer.