Excel tutorial
/

Excel basics

Intermediate

Dates and times in Excel: day differences, working hours and times over 24 hours

How Excel stores dates and times, subtracting dates, counting workdays, calculating hours and pay, and why totals over 24 hours need the [h]:mm format.

In Excel a date is a number: the count of days since January 1, 1900. 01.01.2025 is really 45658. Time is a fraction of a day: 12:00 is 0.5, 06:00 is 0.25, one hour is 1/24.

This simple fact explains everything: why you can subtract dates to get the number of days, why a date plus 30 gives a date a month later, and why a total of working hours sometimes looks “weird”. The look is just formatting — inside, it is always a number.

Книга1 - Excel
—☐✕
B6fx=B2+30
ABCD
1WhatHow it looksInside Excel
2Date01.01.202545658
3Time12:000,5
4Date and time01.01.2025 18:0045658,75
51 hour01:000,0416666666667
6Date +30 days31.01.202545688
7
Готово
Column B uses date/time formats, column C shows the same values in General format. 01.01.2025 18:00 = 45658.75

Entering and checking a date correctly

1

Type the date in your computer’s format, for example 15.01.2025 (or 1/15/2025 with US settings). If Excel recognizes it, the cell aligns right — it’s a number, a real date.

Книга1 - Excel
—☐✕
B2fx45672
ABCD
1OrderDate
2No. 10115.01.20251
3No. 10215/01/20252
4
5
Готово
1 — a real date (right-aligned). 2 — an entry Excel didn’t recognize: left-aligned text you can’t calculate with

2

Insert today’s date quickly with Ctrl + ;, the current time with Ctrl + Shift + ;. These are not formulas — the value is written once and won’t change tomorrow.

3

To see what the cell really holds, press Ctrl + 1 (Format Cells). On the Number tab switch Category to General — a number appears instead of the date. Pick the look you want under Date or Custom.

Книга1 - Excel
—☐✕
B2fx45672
ABCD
1OrderDate
2No. 10115.01.2025
3
4
5
Готово

4

The most reliable way to create a date is a formula: =ДАТА(2025;1;15) — year, month, day. It doesn’t depend on regional settings and opens correctly in anyone’s Excel.

Calculating with dates

  • Days between: =B2-A2 — the result is a number of days (give the cell General or Number format).
  • N days later: =A2+30; N months later: =ДАТАМЕС(A2;3) — handles month lengths for you.
  • End of month: =КОНМЕСЯЦА(A2;0); end of next month — =КОНМЕСЯЦА(A2;1).
  • Number of workdays: =ЧИСТРАБДНИ(A2;B2) — Saturdays and Sundays excluded. Pass a holiday list as the third argument (March 8, Navruz, Independence Day) and those are excluded too.
  • Date 10 workdays later: =РАБДЕНЬ(A2;10).
  • Date parts: =ГОД(A2), =МЕСЯЦ(A2), =ДЕНЬ(A2), =ДЕНЬНЕД(A2;2) — 1 is Monday, 7 is Sunday.
  • Today: =СЕГОДНЯ() — updates itself every day.
Книга1 - Excel
—☐✕
E2fx=ЧИСТРАБДНИ(B2;C2)
ABCDEF
1OrderDateDue dateMonth endWorkdays
2No. 10115.01.202514.02.202531.01.202523
3No. 10207.02.202509.03.202528.02.202521
4No. 10310.03.202509.04.202531.03.202523
5
Готово
30 calendar days hold only 21–23 workdays — NETWORKDAYS leaves out the weekends

Calculating with time: working hours and pay

Since time is a fraction of a day, “Left − Arrived” gives the time worked: =C2-B2 → 09:00.

But that is not yet a number of hours — it is 0.375 (37.5% of a day). Multiply by 24 to get hours: =(C2-B2)*24 → 9. Only then calculate pay: =E2*25000.

Multiply the time by the hourly rate without the ×24 and the pay comes out 24 times too small — the most common mistake.

Книга1 - Excel
—☐✕
E2fx=D2*24
ABCDEFG
1EmployeeArrivedLeftWorkedHoursPay
2Aziz09:0018:0009:009,0225 000
3Dilnoza08:3017:3009:009,0225 000
4Javohir10:0019:3009:309,5237 500
5
Готово
Column D is time (09:00), column E is a number of hours (9.0). Pay is multiplied by the hours only
Книга1 - Excel
—☐✕
fx
ABCD
1DayWorked
2Monday08:00
3Tuesday07:30
4Wednesday08:30
5Thursday07:00
6Total (hh:mm)07:001
7Total ([h]:mm)31:002
8Total hours31,0
9
Готово
1 — plain hh:mm: of 31 hours only 07:00 is visible. 2 — the same total in [h]:mm format: 31:00

Pro level: night shifts, age and other subtleties

  • Shifts past midnight. From 22:00 to 06:00, =C2-B2 returns a negative number and the cell shows ####. The correct formula: =ОСТАТ(C2-B2;1) → 08:00. MOD adds one day to a negative difference.
  • Full age or length of service: =РАЗНДАТ(A2;СЕГОДНЯ();"y") — full years; "m" — months, "d" — days. The function exists but isn’t listed in autocomplete — you type its name yourself.
  • Day name: =ТЕКСТ(A2;"dddd") → “Wednesday”. Note: in localized Excel (Russian, for example) the format codes inside TEXT are localized too — "ДД.ММ.ГГГГ" — so English codes give wrong results there.
  • Dates stored as text (from accounting software or a website): =ДАТАЗНАЧ(A2), or Данные → Text to Columns → on the last step choose Date: DMY.
  • Fun fact: Excel treats 1900 as a leap year, so 29.02.1900 “exists” (serial 60). It is a bug kept for compatibility with old Lotus 1-2-3 — for dates before March 1900, weekdays are off by one.
Книга1 - Excel
—☐✕
E2fx=ОСТАТ(C2-B2;1)
ABCDEF
1EmployeeArrivedLeftPlain subtractionWith MOD
2Aziz22:0006:00########08:00
3Dilnoza21:0007:00########10:00
4
5
Готово
Night shift: =C2-B2 is negative, so you see ####, while =MOD(C2-B2,1) returns 08:00

Try it in the simulator

The simulator shows dates without formatting — exactly as Excel stores them: 45658 is 01.01.2025, 45724 is 08.03.2025. Type =B2-A2 in C2 (how many days?), =ГОД(B2) in D2 and =ТЕКСТ(B2;"dd.mm.yyyy") in E2.

Книга1 - Excel
—☐✕
Буфер обмена
Шрифт
Выравнивание
Число
Стили
Ячейки
Редактирование
✕✓fx
ABCDEFGHIJKLMNOPQRSTUVWX
1StartEndDaysYearDate as text
24565845724
3
4
5
6
7
8
9
10
Лист1
Готово

Has ExcelLab been useful?

Support the project and help us release new lessons and exercises.

Support us
Previous

23 / 154