Excel Practice Test

โ–ถ

Calculating the days between dates excel users need every day sounds simple, yet it trips up beginners and seasoned analysts alike. Whether you are counting down to a vacation at a resort like excellence playa mujeres, tracking invoice due dates, or measuring project timelines, Excel offers several reliable ways to find the exact number of days, months, or years separating two calendar dates. This guide walks through every method, from plain subtraction to the hidden DATEDIF function, with concrete examples you can copy into a worksheet right now and adapt to your own data.

Calculating the days between dates excel users need every day sounds simple, yet it trips up beginners and seasoned analysts alike. Whether you are counting down to a vacation at a resort like excellence playa mujeres, tracking invoice due dates, or measuring project timelines, Excel offers several reliable ways to find the exact number of days, months, or years separating two calendar dates. This guide walks through every method, from plain subtraction to the hidden DATEDIF function, with concrete examples you can copy into a worksheet right now and adapt to your own data.

At its core, Excel stores every date as a serial number. January 1, 1900 is day 1, and each day after that increments by one. December 31, 2026 is serial number 46387. Because dates are really just numbers in disguise, you can subtract one from another and Excel returns the difference as a count of days. This single insight unlocks almost everything you will do with date arithmetic, and understanding it prevents the confusion that arises when results display as dates instead of plain numbers.

The simplest formula is direct subtraction. If cell A2 holds a start date and B2 holds an end date, the formula =B2-A2 returns the number of days between them. For example, subtracting March 1, 2026 from March 15, 2026 yields 14. No function is required. The only catch is formatting: if the result cell is formatted as a date, Excel may show a strange date instead of the number 14, so you must format the result cell as General or Number.

When you need more nuance, the DATEDIF function steps in. DATEDIF accepts three arguments: a start date, an end date, and a unit code in quotes such as "d" for days, "m" for whole months, or "y" for whole years. Curiously, Microsoft does not list DATEDIF in the formula autocomplete dropdown, a legacy quirk from Lotus 1-2-3 compatibility. Despite its hidden status, it works in every modern version of Excel and remains the go-to tool for clean month and year counts.

Business users often need to exclude weekends from their counts. Counting calendar days is fine for personal planning, but payroll, shipping estimates, and service-level agreements usually run on business days. The NETWORKDAYS function counts weekdays between two dates and can even skip a list of holidays you supply. This makes it indispensable for anyone calculating delivery windows, contract deadlines, or the number of working days remaining in a fiscal quarter.

Throughout this article you will see real numbers, edge cases, and step-by-step breakdowns rather than vague theory. We cover leap years, negative results, the difference between inclusive and exclusive counts, and the formatting traps that cause the most help-desk tickets. By the end you will confidently choose the right formula for any scenario, whether you manage a single spreadsheet or build complex financial models that depend on accurate elapsed-time calculations across thousands of rows.

If you want to pair this skill with deeper spreadsheet knowledge, our days between dates excel resource shows how date math feeds directly into loan schedules, interest accrual, and amortization tables where every elapsed day changes the result. Date calculations are rarely an end in themselves; they are the foundation for the financial and operational logic that makes a spreadsheet genuinely useful in the real world.

Date Math in Excel by the Numbers

๐Ÿ“…
46387
Serial for Dec 31 2026
โฑ๏ธ
3
DATEDIF Core Units
๐Ÿ“Š
5
Default Work Days
๐Ÿ”„
366
Days in a Leap Year
โœ…
1900
Excel Date Origin
Practice Days Between Dates Excel Questions Free

The Main Methods for Counting Days Between Dates

โž– Direct Subtraction

The fastest method. Type =B2-A2 to return calendar days between two dates. Works in every Excel version with no function needed, but you must format the result cell as Number or General to avoid seeing a date.

๐Ÿ“ DATEDIF Function

Use =DATEDIF(A2,B2,"d") for days, "m" for whole months, or "y" for whole years. Hidden from autocomplete but fully supported. Ideal when you need clean month or year counts rather than raw day totals across long spans.

๐Ÿ’ผ NETWORKDAYS

Counts only business days, skipping Saturdays and Sundays. Add a third argument with a holiday range to exclude public holidays. Perfect for shipping windows, payroll periods, and contract deadlines that ignore weekends entirely.

๐Ÿ“Š YEARFRAC Function

Returns the fractional number of years between two dates, such as 1.5 years. Useful for interest, age, and tenure calculations where partial years matter and a whole-number count would lose important precision in the result.

Let us walk through DATEDIF in detail because it solves the most common real-world problems. Suppose A2 contains 1/15/2025 and B2 contains 6/1/2026. The formula =DATEDIF(A2,B2,"d") returns 502, the exact number of calendar days. Change the unit to "m" and you get 16 whole months. Change it to "y" and you get 1 whole year. Notice that month and year counts ignore partial periods, so they round down to the last completed unit rather than rounding to the nearest value.

DATEDIF also supports compound units that many users never discover. The unit "ym" returns the number of months remaining after whole years are removed, while "md" returns leftover days after whole months are removed. Combining them lets you produce phrases like "1 year, 4 months, and 17 days" for an age or tenure display. This technique appears constantly in HR dashboards and is far cleaner than manually subtracting and dividing date components by hand.

A frequent question is how skills like this relate to lookups. Many people search for vlookup excel because they store dates in one table and want to pull matching values from another. VLOOKUP itself does not calculate elapsed time, but you can nest a DATEDIF result inside a lookup, or look up a start date and subtract it from today. The two functions complement each other: one retrieves the dates, the other measures the distance between them with precision.

Always confirm that your dates are genuine date values and not text that merely looks like a date. A quick test is to select the cell and check whether it right-aligns; real dates and numbers right-align by default, while text left-aligns. If DATEDIF returns a #VALUE! error, text dates are almost always the culprit. You can convert them using DATEVALUE or by multiplying the cell by 1, which forces Excel to coerce a recognizable string into a usable serial number.

The order of arguments matters more than people expect. DATEDIF requires the start date first and the end date second. If you reverse them, Excel returns a #NUM! error rather than a negative number, which is the opposite behavior of plain subtraction. This asymmetry surprises users migrating from simple =B2-A2 formulas, so when you build templates, add a small validation check or arrange your columns so the earlier date always sits to the left of the later one.

For dynamic dashboards, replace the end-date argument with the TODAY function so your counts refresh automatically. The formula =DATEDIF(A2,TODAY(),"d") shows how many days have elapsed since a start date every time the workbook opens. This is perfect for tracking days since a customer signed up, days a ticket has been open, or days remaining until a deadline when you flip the arguments. Combine it with conditional formatting to highlight overdue items in red the moment they cross a threshold.

One caution about combining DATEDIF with other functions: wrap it in IFERROR when end dates might be blank. An empty cell evaluates as serial number zero, which sits in the year 1900 and produces nonsensical or negative results. The formula =IFERROR(DATEDIF(A2,B2,"d"),"") leaves the cell blank until both dates exist, keeping your reports clean and preventing a cascade of error values from flowing into summary totals, charts, and pivot tables downstream.

FREE Excel Basic and Advance Questions and Answers
Test your knowledge of core Excel skills from formatting to formulas with instant feedback.
FREE Excel Formulas Questions and Answers
Practice date math, lookups, and logical formulas with realistic multiple-choice questions.

How VLOOKUP Excel and Date Functions Work Together

๐Ÿ“‹ Looking Up Dates

VLOOKUP excel users often store a start date alongside a customer ID or project name. To retrieve that date, use =VLOOKUP(A2,Table,3,FALSE) where column three holds the date. The result comes back as a serial number that you can immediately subtract from another date to find elapsed days, blending retrieval and calculation in a single tidy step that keeps your worksheet compact.

Because the lookup returns a true date serial, you can nest it directly inside arithmetic. For example =TODAY()-VLOOKUP(A2,Table,3,FALSE) tells you how many days have passed since the looked-up start date. Just remember to format the result as a number so Excel does not reinterpret the count as a calendar date and confuse the people reading your report.

๐Ÿ“‹ Date-Based Matching

Sometimes you need to match a date against a range, such as finding which billing period a transaction falls into. Here VLOOKUP with TRUE for approximate match shines. Sort your period start dates ascending, then =VLOOKUP(C2,Periods,2,TRUE) returns the correct period label for any transaction date that falls on or after a period boundary defined in your lookup table.

This approximate-match technique powers tiered pricing, fiscal calendar mapping, and aging buckets. Combine it with DATEDIF to first compute the age of an item, then look up which aging tier that number belongs to, producing a clean report that classifies every record by how many days old it is without any manual sorting work.

๐Ÿ“‹ Common Pitfalls

The biggest VLOOKUP excel trap with dates is mixing text dates and real dates in the same column. A lookup value stored as text will never match a serial-number date, returning #N/A even when the dates look identical on screen. Standardize the column first using DATEVALUE so every entry is a true date before you attempt any matching at all.

Another pitfall is forgetting FALSE for exact matches. Leaving the fourth argument blank defaults to approximate match, which silently returns wrong results on unsorted data. Always specify FALSE for ID lookups and reserve TRUE strictly for sorted range lookups like aging buckets, fiscal periods, or graduated tax brackets where the boundaries genuinely matter.

Subtraction vs DATEDIF: Which Method Should You Use?

Pros

  • Plain subtraction is the fastest way to get calendar days
  • DATEDIF gives clean whole-month and whole-year counts
  • DATEDIF supports compound units like years plus months plus days
  • Subtraction works instantly with no function syntax to remember
  • DATEDIF returns errors instead of confusing negative numbers
  • Both methods refresh automatically when paired with TODAY()

Cons

  • Subtraction shows a date instead of a number if formatting is wrong
  • DATEDIF is hidden from the formula autocomplete dropdown
  • DATEDIF throws #NUM! when arguments are in reverse order
  • Plain subtraction cannot count whole months or years directly
  • Text dates break both methods with #VALUE! errors
  • Blank end dates produce nonsense results in either approach
FREE Excel Functions Questions and Answers
Sharpen your skills on DATEDIF, NETWORKDAYS, VLOOKUP and other essential Excel functions.
FREE Excel MCQ Questions and Answers
Quick multiple-choice questions covering formulas, formatting, and spreadsheet fundamentals.

Days Between Dates Excel Formula Checklist

Confirm both cells contain real dates, not text that looks like dates.
Format the result cell as Number or General to see a plain count.
Place the earlier date in the start argument of DATEDIF.
Use =B2-A2 for a quick calendar-day count between two dates.
Use DATEDIF with "m" or "y" for whole months and years.
Wrap formulas in IFERROR to handle blank or invalid dates.
Use NETWORKDAYS when weekends should be excluded from the count.
Supply a holiday range as the third NETWORKDAYS argument.
Pair TODAY() with your formula to refresh counts automatically.
Verify leap years are handled by testing a span across February 29.
Always format the result cell first

The single most common date-math complaint is a subtraction that displays as a date like 1/14/1900 instead of the number 14. Excel inherits the format from the date cells. Before you trust any result, select the cell, press Ctrl+1, and choose Number or General. This one step eliminates the majority of help-desk tickets about date calculations.

Business days are where date math earns its keep in the workplace. The NETWORKDAYS function counts only Monday through Friday between two dates, automatically skipping every Saturday and Sunday. The formula =NETWORKDAYS(A2,B2) between Monday March 2, 2026 and Friday March 13, 2026 returns 10, the two full work weeks in that span. Unlike plain subtraction, which would return 11 calendar days, NETWORKDAYS reflects how shipping carriers, payroll systems, and contract deadlines actually count elapsed working time in practice.

To exclude public holidays, list them in a range and pass it as the third argument. If cells E2:E6 hold the federal holidays for 2026, the formula =NETWORKDAYS(A2,B2,E2:E6) subtracts any of those dates that fall on a weekday within your span. This is essential for accurate service-level agreements, since promising a five business-day turnaround means little if your count includes Memorial Day or Thanksgiving when nobody is processing orders or answering tickets.

When your work week does not run Monday to Friday, reach for NETWORKDAYS.INTL. This newer variant accepts a weekend code so you can define Sunday-only weekends, Friday-Saturday weekends common in many countries, or even custom patterns using a seven-character string of ones and zeros. For a business that operates Tuesday through Saturday, this flexibility means your day counts finally match reality instead of forcing you to build awkward manual adjustments into every deadline calculation you produce.

The companion function WORKDAY runs the calculation in reverse. Instead of counting business days between two known dates, it adds a number of business days to a start date and returns the resulting deadline. The formula =WORKDAY(A2,10,E2:E6) tells you the date exactly ten working days after the start, skipping weekends and your holiday list. Project managers use this constantly to compute realistic delivery dates that account for the actual working calendar rather than raw elapsed days.

Edge cases deserve attention. NETWORKDAYS includes both the start and end dates in its count when they are weekdays, which makes it an inclusive count rather than an exclusive one. If you only want the days in between, subtract one from the result. This inclusive behavior is the opposite of plain subtraction, so mixing the two methods in the same report without understanding the difference produces totals that are off by one and surprisingly hard to debug later.

Holidays that shift each year, like Thanksgiving on the fourth Thursday of November, are best calculated rather than typed manually. You can build a small holiday table once with formulas, then reference it across every NETWORKDAYS calculation in the workbook. This keeps your business-day counts accurate year after year without anyone having to remember to update a hardcoded list, which is exactly the kind of maintenance burden that causes errors to creep into long-lived spreadsheets.

Finally, combine NETWORKDAYS with conditional formatting to flag deadlines that are approaching. A formula like =NETWORKDAYS(TODAY(),B2)<=3 returns TRUE when fewer than three business days remain, and a conditional format rule can paint those cells amber. This turns a static spreadsheet into a living dashboard that draws the eye to whatever needs attention first, helping teams prioritize work without manually scanning hundreds of rows every single morning before the day begins.

Avoiding date errors is mostly about understanding how Excel thinks about time. Every error you will encounter traces back to a small number of root causes: text masquerading as dates, wrong cell formatting, reversed arguments, or blank cells treated as the year 1900. Once you recognize these patterns, troubleshooting becomes fast. The same diagnostic habits that help here also make you more confident across the broader spreadsheet skills covered in our how to merge cells in excel companion guides.

Leap years are handled automatically by Excel because the serial-number system already accounts for February 29 in years like 2024 and 2028. You never need to add special logic for them. A subtraction or DATEDIF that spans a leap day simply returns the correct, larger count. Test this yourself by measuring the days from February 28, 2024 to March 1, 2024; you will get 2 because 2024 included a February 29 between those two dates.

Negative results are a feature, not a bug, when you use plain subtraction. If your end date is earlier than your start date, =B2-A2 returns a negative number, which is genuinely useful for spotting data-entry mistakes. DATEDIF, by contrast, refuses negative spans and throws #NUM! instead. Choose subtraction when you want to detect reversed dates and DATEDIF when you want the calculation to fail loudly so you notice the problem immediately.

The 1900 leap-year bug is a famous Excel quirk worth knowing. Excel incorrectly treats 1900 as a leap year for backward compatibility with Lotus 1-2-3, so serial number 60 maps to a nonexistent February 29, 1900. This only matters for dates before March 1, 1900, which almost nobody uses, but it explains why date math involving very old historical dates can be off by one day compared to other software systems.

Regional date formats cause real confusion on shared workbooks. A date typed as 03/04/2026 means March 4 in the United States but April 3 in much of the world. Excel interprets ambiguous text according to your system locale, so a file that calculated correctly on one machine can shift on another. The safest defense is entering dates in the unambiguous ISO format of YYYY-MM-DD, or using the DATE function with explicit year, month, and day arguments.

When you import data from a database or web export, dates frequently arrive as text strings. The fastest fix is to select the column, open Data then Text to Columns, click through to the final step, and choose the Date format with the correct order. This converts the entire column to real dates in one pass, sparing you from writing DATEVALUE formulas in a helper column and then pasting the values back over the originals.

Document your assumptions inside the workbook itself. Add a note explaining whether your counts are inclusive or exclusive, whether weekends are excluded, and which holiday list feeds your NETWORKDAYS formulas. Future readers, including yourself six months later, will thank you. A one-line comment prevents the off-by-one errors and misread totals that quietly undermine trust in a spreadsheet that everyone assumed was correct because it had always seemed to work fine before.

Test Your Excel Formulas Knowledge Now

With the core methods covered, here is the practical workflow professionals use to get date math right the first time. Start by laying out your dates in clearly labeled columns, with the earlier date always to the left. This habit alone prevents the reversed-argument errors that plague DATEDIF, and it makes your formulas readable to anyone reviewing the workbook. A clean layout is the quiet foundation of every reliable calculation you will build on top of it.

Next, decide whether you need calendar days or business days before you write a single formula. This choice drives everything downstream. If a stakeholder asks for the days until a deadline, clarify whether weekends count. Misunderstanding this requirement is the most common reason a date report gets rejected and reworked. Five minutes of clarification at the start saves hours of recalculation and rebuilt charts once someone notices the totals do not match their expectations.

Build your formula in a single test row first, verify the result by hand against a calendar, and only then fill it down the entire column. Spot-checking one row against a known answer catches formatting traps and argument-order mistakes before they propagate across thousands of records. This disciplined approach feels slow but is dramatically faster than discovering a systematic error after you have already shared the report with your team or, worse, a client.

For recurring reports, invest in a small reusable template. Include a TODAY-driven elapsed-days column, an IFERROR wrapper for blanks, and a NETWORKDAYS column for business-day counts. Save it as a starting point so you never rebuild the same logic twice. Templates also enforce consistency, ensuring that every report from your team counts days the same way and uses the same holiday list rather than each person inventing their own conventions.

Pair your date calculations with conditional formatting to surface what matters. Color overdue items red, items due this week amber, and completed items green. A spreadsheet that visually communicates urgency is far more useful than a wall of numbers. The combination of accurate date math and clear formatting transforms a raw data dump into a decision-making tool that managers actually open and act on each morning without prompting.

Practice is what cements these skills. Working through realistic questions on DATEDIF, NETWORKDAYS, and VLOOKUP under exam-style conditions reveals the gaps in your understanding far better than reading alone. The free practice tests linked throughout this article cover exactly the date-and-lookup scenarios you will face on the job and in certification exams, so set aside thirty minutes to test yourself and confirm that the concepts here have truly stuck.

Finally, keep learning adjacent skills that compound with date math. Knowing how to freeze a row in excel keeps your date headers visible while you scroll, and knowing how to create a drop down list in excel lets you build clean date-category filters. Each small skill multiplies the value of the others, and together they turn you into the person on the team everyone asks when a spreadsheet needs to actually work correctly under pressure.

FREE Excel Questions and Answers
A broad certification-style practice test covering formulas, functions, and core spreadsheet skills.
FREE Excel Trivia Questions and Answers
Fun, fast trivia to sharpen your Excel knowledge and discover features you may have missed.

Excel Questions and Answers

How do I calculate the number of days between two dates in Excel?

The simplest method is direct subtraction. If A2 holds the start date and B2 holds the end date, type =B2-A2 and press Enter. Excel returns the number of calendar days between them. Make sure the result cell is formatted as Number or General, because if it inherits a date format you will see a date instead of the plain count you expect.

Why does my date subtraction show a date instead of a number?

Excel copies the date format from your source cells into the result. Although the underlying value is correct, the cell displays it as a calendar date. Select the result cell, press Ctrl+1 to open Format Cells, and choose Number or General. The cell will immediately switch to showing the day count, such as 14 instead of an odd date like January 14, 1900.

What does the DATEDIF function do?

DATEDIF calculates the difference between two dates in days, months, or years depending on a unit code you supply in quotes. Use "d" for days, "m" for whole months, and "y" for whole years. It also supports compound units like "ym" and "md". Although hidden from the autocomplete menu, it works in every modern version of Excel and is ideal for tenure or age calculations.

Why is DATEDIF not showing up when I type it?

DATEDIF is a legacy function carried over from Lotus 1-2-3 compatibility, and Microsoft deliberately omits it from the formula autocomplete dropdown and function wizard. This does not mean it is broken or unavailable. Simply type the full formula yourself, including all three arguments, and it will calculate correctly. The lack of autocomplete is the only quirk; the function itself is fully supported.

How do I count only business days between two dates?

Use the NETWORKDAYS function, which counts Monday through Friday and skips weekends automatically. The formula =NETWORKDAYS(A2,B2) returns the number of working days between two dates inclusively. To exclude public holidays, list them in a range and add it as a third argument, like =NETWORKDAYS(A2,B2,E2:E6). For non-standard weekends, use NETWORKDAYS.INTL with a custom weekend code instead.

How can I find the number of months between two dates?

Use DATEDIF with the month unit code. The formula =DATEDIF(A2,B2,"m") returns the number of complete months between the start and end dates, ignoring any partial month at the end. If you need both months and leftover days, combine "m" with the "md" unit. Remember that the start date must come first or DATEDIF will return a #NUM! error rather than a result.

How do I calculate someone's age in years from a birthdate?

Combine DATEDIF with the TODAY function so the age updates automatically. The formula =DATEDIF(A2,TODAY(),"y") returns the person's age in completed years, where A2 holds the birthdate. For a fuller display you can concatenate the year, month, and day units to produce text like "34 years, 2 months". This approach correctly handles leap years and partial years without any manual adjustment.

Why does my date formula return a #VALUE! error?

A #VALUE! error almost always means one of your cells contains a date stored as text rather than a true date serial number. Text dates often come from imports or web pastes. Check alignment, since text left-aligns while real dates right-align. Convert text dates using =DATEVALUE(A2), by multiplying the cell by 1, or with Data then Text to Columns set to the Date format.

Does Excel handle leap years automatically in date calculations?

Yes. Because Excel stores every date as a serial number that already accounts for the extra day in leap years, any subtraction, DATEDIF, or NETWORKDAYS calculation spanning February 29 returns the correct count without special handling. For example, counting from February 28, 2024 to March 1, 2024 returns 2 days because 2024 was a leap year and included February 29 between those two dates.

How do I add a number of working days to a date?

Use the WORKDAY function, which is the reverse of NETWORKDAYS. The formula =WORKDAY(A2,10) returns the date exactly ten business days after the start date in A2, skipping weekends. Add a holiday range as a third argument, like =WORKDAY(A2,10,E2:E6), to also skip public holidays. Project managers rely on this to compute realistic delivery deadlines that respect the actual working calendar.
โ–ถ Start Quiz