SkillNavoraData Science & AI Handbook
Advanced Excel · Lesson 9 of 12

Date, Time & Number Functions and Named Ranges

Work confidently with dates and times (DATE, EOMONTH, EDATE, WORKDAY, NETWORKDAYS, WEEKDAY, WEEKNUM, DATEDIF, fiscal quarters), clean up numbers with INT, MOD, ROUND, CEILING and FLOOR, and make formulas readable with static and dynamic named ranges and LET.

● Live classes 7–8✦ Excel for Microsoft 365, 2026Intermediate⏱ 120 min
By the end of this lesson you can
  • Explain how Excel stores dates and times, and do date arithmetic correctly
  • Extract parts of dates, find month ends, add months, and count working days with holidays
  • Calculate age, tenure and fiscal-year quarters (Indian April–March and US October–September)
  • Use INT, MOD, ROUND, ROUNDUP, ROUNDDOWN, MROUND, CEILING.MATH, FLOOR.MATH, SQRT, POWER and ABS
  • Create static and dynamic named ranges and simplify long formulas with LET

Dates and times are numbers

Excel stores a date as the number of days since 1 January 1900 (that day is 1). A time is a fraction of a day: 12:00 noon is 0.5 and 06:00 is 0.25. A date with a time is simply a whole number plus a fraction.

XWhat is really stored
ABC
1You seeStored asExplanation
227-04-202646139Days since 1-Jan-1900
312:000.5Half a day
406:300.27086.5 hours ÷ 24
527-04-2026 18:0046139.75Date + time
  • B2=A2
  • B3=TIME(12,0,0)
  • B4=TIME(6,30,0)
  • B5=DATE(2026,4,27)+TIME(18,0,0)

This is why date arithmetic works:

XDate arithmetic
ABCDE
1Order dateShip dateDays to ship =B2-A2Due date (+30 days)Overdue? (as of 15-Jun-2026)
227-04-202602-05-2026527-05-2026Overdue
320-05-202621-05-2026119-06-2026OK
401-06-202608-06-2026701-07-2026OK
  • C2=B2-A2
  • D2=A2+30
  • E2=IF(DATE(2026,6,15)>D2,"Overdue","OK")
  • Each pattern is copied down/across to the other cells in its column.
TipTODAY() and NOW()

=TODAY() returns today's date and =NOW() the date and time. They are volatile: they recalculate every time the workbook changes, so results move every day. For reports that must not change, type the "as of" date into a cell and refer to it, as in the overdue example above. Shortcuts: Ctrl + ; types today's date as a fixed value.

Building and taking apart dates

Function Returns Example (A2 = 27-04-2026) Result
DATE(y, m, d) A date from parts =DATE(2026,4,27) 27-04-2026
YEAR, MONTH, DAY Parts of a date =MONTH(A2) 4
WEEKDAY(date, 2) 1 = Monday … 7 = Sunday =WEEKDAY(A2,2) 1
WEEKNUM(date, 2) Week of the year (weeks start Monday) =WEEKNUM(A2,2) 18
ISOWEEKNUM(date) ISO 8601 week number =ISOWEEKNUM(A2) 18
TEXT(date, "mmm") Month name as text =TEXT(A2,"mmmm") April
EOMONTH(date, n) Last day of the month n months away =EOMONTH(A2,0) 30-04-2026
EDATE(date, n) Same day n months later =EDATE(A2,3) 27-07-2026
DATEVALUE(text) Converts date text to a real date =DATEVALUE("27-Apr-2026") 46139
XDate parts and month boundaries
ABCDEFGH
1DateYearMonthDayWeekday (Mon=1)Month endFirst of month+3 months
227-04-20262026427130-04-202601-04-202627-07-2026
331-01-20262026131631-01-202601-01-202628-02-2026
429-02-20242024229429-02-202401-02-202428-02-2025

Notice that EDATE handles month ends correctly: 31-Jan + 1 month = 28-Feb (2026 is not a leap year), and 29-Feb-2024 + 12 months = 28-Feb-2025.

Working days

Function Use
NETWORKDAYS(start, end, [holidays]) Count Mon–Fri days between two dates (inclusive) minus holidays
NETWORKDAYS.INTL(start, end, weekend, [holidays]) Choose weekend days: 11 = Sunday only, "0000011" = Sat + Sun
WORKDAY(start, days, [holidays]) The date after adding n working days
WORKDAY.INTL(start, days, weekend, [holidays]) Same with a custom weekend
XSLA and delivery planning (holidays in G2:G4)
ABCDEFG
1TicketOpenedClosedWorking days =NETWORKDAYS(B2,C2,$G$2:$G$4)Due (+5 working days)Holidays
2T-10110-08-202618-08-2026717-08-202615-08-2026
3T-10216-10-202623-10-2026526-10-202620-10-2026
4T-10306-11-202610-11-2026412-11-202608-11-2026

T-103 uses a Sunday-only weekend (code 11), common in Indian factories and retail. The holiday on 15-Aug-2026 falls on a Saturday, so it does not change T-101's count of working days.

Age, tenure and durations

DATEDIF(start, end, unit) is a hidden function (no tooltip) that returns complete years, months or days between two dates.

Unit Returns
"y" Complete years
"m" Complete months
"d" Days
"ym" Months after removing complete years
"md" Days after removing complete months
XTenure as of 31-Mar-2026 (in F1)
ABCDEF
1EmployeeJoin dateYearsMonths after yearsTenure label31-03-2026
2Kavya Iyer28-02-201610110 yrs 1 mths
3Imran Reddy14-12-2019636 yrs 3 mths
4Saanvi Rao18-02-2025111 yrs 1 mths

(Cell F1 holds the date 31-03-2026.) For fractional years use =YEARFRAC(B2,$F$1), for example 10.09 years.

Fiscal years and quarters

Calendar quarter: ="Q"&ROUNDUP(MONTH(A2)/3,0). Many organisations use a different financial year:

Year type Q1 Formula for the quarter number
Calendar Jan–Mar =ROUNDUP(MONTH(A2)/3,0)
India (FY Apr–Mar) Apr–Jun =ROUNDUP(MOD(MONTH(A2)-4,12)/3+0.01,0) or =CHOOSE(MONTH(A2),4,4,4,1,1,1,2,2,2,3,3,3)
US federal (FY Oct–Sep) Oct–Dec =CHOOSE(MONTH(A2),2,2,2,3,3,3,4,4,4,1,1,1)
XCalendar, Indian FY and US FY quarters
ABCDE
1DateCalendar QIndia FY quarterIndia FY labelUS FY quarter
210-02-2026Q1Q4FY26Q2
327-04-2026Q2Q1FY27Q3
403-11-2026Q4Q3FY27Q1

In the Indian convention, 27-Apr-2026 falls in FY27 (April 2026 – March 2027), quarter Q1.

Times

Function Example Result
TIME(h, m, s) =TIME(14,30,0) 14:30
HOUR, MINUTE, SECOND =HOUR(A2) 14
Duration in hours =(end-start)*24 8.5
Duration beyond 24 h Format [h]:mm 37:30
Shifts past midnight =MOD(end-start,1) Works when end is the next day

A very common clean-up task: a system exports times as plain numbers like 1430 meaning 14:30. Convert them with INT and MOD:

XConvert 1430-style numbers into real times
ABCDE
1RawHours =INT(A2/100)Minutes =MOD(A2,100)Time =TIME(INT(A2/100),MOD(A2,100),0)Shift length (to B6)
293093009:308.75
31430143014:30
42245224522:45
550500:05
61815181518:15

Number functions

Function What it does Example Result
INT(n) Rounds down to the integer =INT(-7.6) −8
TRUNC(n, [d]) Cuts off decimals (towards zero) =TRUNC(-7.6) −7
ROUND(n, d) Normal rounding =ROUND(7.456,2) 7.46
ROUNDUP(n, d) Always away from zero =ROUNDUP(7.401,0) 8
ROUNDDOWN(n, d) Always towards zero =ROUNDDOWN(7.99,0) 7
ROUND(n, -3) Round to thousands =ROUND(123456,-3) 123000
MROUND(n, m) Nearest multiple =MROUND(17,5) 15
CEILING.MATH(n, m) Up to the next multiple =CEILING.MATH(23,7) 28
FLOOR.MATH(n, m) Down to the previous multiple =FLOOR.MATH(23,7) 21
MOD(n, d) Remainder =MOD(28,3) 1
QUOTIENT(n, d) Integer part of a division =QUOTIENT(28,3) 9
ABS(n) Absolute value =ABS(-450) 450
SIGN(n) −1, 0 or 1 =SIGN(-450) −1
SQRT(n) Square root =SQRT(144) 12
POWER(n, p) Power (same as ^) =POWER(25,2) 625
XRounding functions side by side
ABCDEFGH
1ValueINTROUND 0ROUNDUP 0ROUNDDOWN 0ROUND 2CEILING.MATH to 5FLOOR.MATH to 5
27.45677877.46105
3-7.456-8-7-8-7-7.46-5-10
423.52324242323.52520

Practical uses

XProfit and Loss columns
ABCD
1StoreProfit / LossProfitLoss
2Pune45200452000
3Delhi-12800012800
4Kochi330033000
5Patna-760007600
6Total281004850020400

Named ranges

A name is a label for a cell, a range, a constant or a formula. =SUM(Sales) is easier to read and audit than =SUM(Data!$O$2:$O$6324).

Static named ranges

Method How
Name Box Select the range, click the Name Box (left of the formula bar), type GST_Rate, press Enter
Define Name Formulas → Define Name: set the name, scope (workbook or one sheet) and comment
Create from Selection Select a table with headers → Formulas → Create from Selection (Ctrl + Shift + F3) → Top row: one name per column
Name Manager Formulas → Name Manager (Ctrl + F3) to edit, delete or find broken names

Rules: names start with a letter or underscore, contain no spaces (use _), cannot look like a cell address (Q1 or FY26 are not allowed) and are not case-sensitive.

XFormulas with names (GST_Rate = F1, Qty and Price are named columns)
ABCDEF
1QtyPriceAmount =Qty*PriceWith GST =Qty*Price*(1+GST_Rate)18%
24125050005,900.00
31029929903,528.20
4289991799821,237.64

(F1, the yellow cell, is named GST_Rate. With names defined, the formula in D2 reads =Qty*Price*(1+GST_Rate).)

Dynamic named ranges

A static name like =$B$2:$B$100 does not grow when you add row 101. A dynamic named range expands automatically, which keeps charts, validation lists and formulas up to date.

Method Refers to Notes
Excel Table (best) =tblSales[Amount] Automatic, no formula needed
OFFSET + COUNTA =OFFSET(Data!$B$2,0,0,COUNTA(Data!$B:$B)-1,1) Classic; volatile (recalculates often)
INDEX + COUNTA =Data!$B$2:INDEX(Data!$B:$B,COUNTA(Data!$B:$B)) Not volatile; preferred over OFFSET
Spill reference =Data!$H$2# Points to a dynamic-array result
A static range stays fixed; a dynamic range grows with the data.
A static range stays fixed; a dynamic range grows with the data.

LET: names inside one formula

LET (Microsoft 365) assigns names to values inside a formula. It makes long formulas readable and faster, because each part is calculated once.

Without LET: =IF(SUMIFS(F:F,C:C,"Finance")/COUNTIFS(C:C,"Finance")>90000,"High","Normal")

With LET:

Excel formula
=LET(
    total, SUMIFS(F:F, C:C, "Finance"),
    heads, COUNTIFS(C:C, "Finance"),
    avg,   total / heads,
    IF(avg > 90000, "High", "Normal")
)

LAMBDA goes one step further and lets you create your own reusable functions; see Lesson 12.

Case: date analysis on Superstore

How long do orders take to ship, by ship mode, and which weekday gets the most orders? In Excel you would add columns =ship_date-order_date and =TEXT(order_date,"ddd") and pivot them. Here are the real answers:

Python
import pandas as pd
s = pd.read_csv("superstore_sales.csv", parse_dates=["order_date", "ship_date"])
orders = s.drop_duplicates("order_id").copy()
orders["days_to_ship"] = (orders.ship_date - orders.order_date).dt.days            # =C2-B2
orders["weekday"] = orders.order_date.dt.day_name().str[:3]                         # =TEXT(B2,"ddd")
orders["fy"] = "FY" + (orders.order_date.dt.year + (orders.order_date.dt.month >= 4)).astype(str).str[2:]   # Indian FY
print(orders.groupby("ship_mode")["days_to_ship"].agg(["mean", "min", "max"]).round(1).to_string())
print()
print(orders.groupby("fy").size().rename("orders").to_string())
Output
                mean  min  max
ship_mode                     
First Class      1.5    1    2
Same Day         0.0    0    0
Second Class     3.0    2    4
Standard Class   5.5    4    7

fy
FY23     169
FY24     952
FY25    1114
FY26     965

Summary

Key takeaways
Quick quiz6 questions · tap an answer to check it

1. A1 contains 27-04-2026 and B1 contains 02-05-2026. What does =B1-A1 return?

Answer: B. Dates are numbers, so subtracting gives the number of days.

2. Which formula returns the last day of the month for the date in A2?

Answer: B. EOMONTH(date,0) returns the month end; the other options fail for 30-day months or February.

3. What does =INT(-3.2) return?

Answer: B. INT always rounds down (towards minus infinity). TRUNC(-3.2) would give −3.

4. Which formula converts the number 1745 into the time 17:45?

Answer: C. INT(1745/100) = 17 hours and MOD(1745,100) = 45 minutes.

5. Why is an INDEX-based dynamic named range often preferred to OFFSET?

Answer: B. Both grow, but OFFSET is volatile.

6. In the Indian financial year, which quarter is 15-January?

Answer: D. FY runs April–March, so January–March is Q4.
ExerciseHR date calculations

Using employees_small.csv and an "as of" date of 31-03-2026 in a cell: (1) tenure in complete years; (2) the probation end date (6 months after joining); (3) the first working day after the probation end; (4) the joining quarter in the Indian FY.

Show solution

With join date in E2 and the as-of date in $J$1: (1) =DATEDIF(E2,$J$1,"y") (2) =EDATE(E2,6) (3) =WORKDAY(EDATE(E2,6)-1,1) (the first working day on or after the probation end) (4) ="Q"&CHOOSE(MONTH(E2),4,4,4,1,1,1,2,2,2,3,3,3)

Interview cornerQuestions you may be asked

Q: How does Excel store dates and times? Dates as serial numbers counting days from 1-Jan-1900; times as fractions of a day. This makes arithmetic, sorting and formatting consistent.

Q: How do you count working days between two dates excluding holidays? NETWORKDAYS(start, end, holidays) or NETWORKDAYS.INTL with a custom weekend code.

Q: What is a dynamic named range and when do you need one? A name whose range grows with the data, built with an Excel Table, INDEX/COUNTA or OFFSET/COUNTA. It keeps charts, validation lists and formulas current as data is added.

Practise more online

Free, trusted places to test yourself on this topic. Links open the original site in a new tab.