Split First and Last Name in Excel — With Examples (TEXTSPLIT, LEFT, FIND)
Learn how to split first and last name in Excel: TEXTSPLIT, LEFT and FIND formulas, middle names, Flash Fill and Text to...
Read Guide →You have a start date and an end date, and you need the days between them — 59, or 267, or 1,815. The answer is simpler than it looks, because Excel does not store a date as a date: it stores it as a number, the count of days since 1 January 1900. So the days between two dates are a subtraction — the later date minus the earlier one. This guide gives you that rule first, then runs all three formulas — subtraction, DAYS and DATEDIF — on one table of dates, so you can check each answer yourself — plus the trap that makes the answer show as a date from 1900, and the TODAY() formula that counts the days since a date without ever being retyped.
Quick takeaway: a date is a number — subtract them.
=B2-A2 — the end date minus the start date, formatted as a number.=DAYS(B2, A2) — the same answer, end date first.=DATEDIF(A2, B2, "D") — the same answer, start date first — and the only one that also gives years and months.=TODAY()-A2 — the days since a date, recalculated every day.
| Formula | How it reads | Order of the dates |
|---|---|---|
=B2-A2 | End date minus start date | End first, start second |
=DAYS(B2, A2) | DAYS, end date first | End first, start second |
=DATEDIF(A2, B2, "D") | DATEDIF, start date first | Start first, end second |
All three give the same number of days. The difference is what else they do: subtraction works everywhere, in every spreadsheet; DAYS is the named version, clearer to read; DATEDIF is the only one that also gives years, months, and the mixed breakdowns — and the only one that errors instead of going negative when the dates are the wrong way round.
Excel stores a date as a serial number: the count of days since 1 January 1900. So 5 January 2026 is serial 46,026, and 5 March 2026 is serial 46,085 — and 46,085 − 46,026 is 59, the days between them. That is the whole trick: subtracting two dates is subtracting two numbers.
| Date | Serial number |
|---|---|
| 5 Jan 2026 | 46,026 |
| 5 Mar 2026 | 46,085 |
| Difference | 59 |
You can see the serial number yourself: put a date in a cell, format it as General, and the number appears. Format it back as a date and the date returns — the value never changed, only the display did. And if your dates include times, the difference is a fraction of a day — 12 hours is 0.5 — and the full guide is the time difference article.
Every example below uses the same five pairs. Every result was checked against them.
| Start | End | =B2-A2 | =DAYS(B2, A2) | =DATEDIF(A2, B2, "D") |
|---|---|---|---|---|
| 5 Jan 2026 | 5 Mar 2026 | 59 | 59 | 59 |
| 10 Mar 2021 | 27 Feb 2026 | 1,815 | 1,815 | 1,815 |
| 24 Nov 2026 | 25 Dec 2026 | 31 | 31 | 31 |
| 29 Feb 2024 | 28 Feb 2025 | 365 | 365 | 365 |
| 1 Jan 2026 | 31 Dec 2026 | 364 | 364 | 364 |
Read the rows. 5 January to 5 March 2026 is 59 days: 26 days left in January, 28 in February, and 5 in March. 10 March 2021 to 27 February 2026 is 1,815 days — five years including the leap year 2024, minus 11 days. 29 February 2024 to 28 February 2025 is 365 days: the leap day is inside the range, so a year that starts on a leap day still counts 365 days to the day before the next leap day. And 1 January to 31 December 2026 is 364 days — not 365, because the count runs from the first day to the last, not through it. That last point is the inclusive-count question, covered below.
The answer is right; the format is wrong. When you subtract two dates, Excel sometimes formats the result cell as a date, and a 59-day difference shows as 29 February 1900 — a date that never existed, because Excel’s 1900 system counts a leap day in 1900 that the real calendar never had. The fix is one step: select the result cell, open the format dropdown on the Home tab, and switch it to General or Number. The number 59 appears, and the date is gone.
| What you see | What it means | Fix |
|---|---|---|
| 29 Feb 1900 | The result cell is formatted as a date — the number 59, shown as a date | Format the cell as General or Number |
| 0 | The two dates are the same day | That is correct — add 1 for an inclusive count |
| A negative number | The start date is after the end date | Swap the dates, or use ABS for the absolute value |
| #NUM! | DATEDIF with the start date after the end date | Swap the dates, or use subtraction instead |
TODAY() returns the current date, and it recalculates every day — so a formula using it never needs retyping. The dates in this article are written against 24 November 2026, the day it was written, so the numbers below are the counts as of that day.
| Goal | Formula | Result (as of 24 Nov 2026) |
|---|---|---|
| Days since 2 Mar 2026 | =TODAY()-A2 | 267 |
| Days since 2 Mar 2026 | =DATEDIF(A2, TODAY(), "D") | 267 |
| Days until 25 Dec 2026 | =B2-TODAY() | 31 |
A project that started on 2 March 2026 is 267 days old on 24 November 2026. Open the same sheet tomorrow and the answer is 268 — the formula did not change, the date did. That is the answer to “count days from a date to today automatically”: put TODAY() in the formula and let Excel do the counting.
Subtraction counts the gap between the dates, not the dates themselves. 5 January to 5 March is 59 days — but if you are counting days on a trip, or days in a booking, you usually want both ends counted: 60 days. Add 1.
| Pair | Gap (=B2-A2) | Inclusive (=B2-A2+1) |
|---|---|---|
| 5 Jan 2026 → 5 Mar 2026 | 59 | 60 |
| 24 Nov 2026 → 25 Dec 2026 | 31 | 32 |
| 1 Jan 2026 → 31 Dec 2026 | 364 | 365 |
| Same day (24 Nov 2026) | 0 | 1 |
The same-day row is the check: two dates on the same day are 0 days apart, but a one-day booking is 1 day long. If your answer is always one short, this is why.
Divide the days by 7 for weeks, and use DATEDIF’s other unit codes for the breakdown.
| Goal | Formula | Result |
|---|---|---|
| Weeks in 59 days | =59/7 | 8 weeks and 3 days |
| Weeks since 2 Mar 2026 | =267/7 | 38 weeks and 1 day |
| Full years | =DATEDIF(A2, B2, "Y") | 4 (10 Mar 2021 → 27 Feb 2026) |
| Full months | =DATEDIF(A2, B2, "M") | 59 (10 Mar 2021 → 27 Feb 2026) |
| Years, months, days | =DATEDIF(A2, B2, "Y") & "y " & DATEDIF(A2, B2, "YM") & "m " & DATEDIF(A2, B2, "MD") & "d" | 4y 11m 17d |
The last row is the full breakdown of the 1,815 days: 4 years, 11 months and 17 days — 10 March 2021 plus 4 years is 10 March 2025, plus 11 months is 10 February 2026, plus 17 days is 27 February 2026. And the working-days version — excluding weekends and holidays — is a different function, NETWORKDAYS, covered in the working days between dates article.
| Mistake | What happens | Fix |
|---|---|---|
| You left the result formatted as a date | The answer shows as 29 Feb 1900 | Format the result cell as General or Number |
| You put the dates the wrong way round in DAYS | A negative number — DAYS takes the end date first | =DAYS(end, start), not =DAYS(start, end) |
| You put the dates the wrong way round in DATEDIF | #NUM! — DATEDIF errors instead of going negative | Swap the dates, or use subtraction |
| You used DAYS360 for a calendar count | DAYS360 counts on 30-day months — 5 Jan to 5 Mar 2026 gives 60, not the real 59 | Use subtraction or DAYS for calendar days; DAYS360 is for 30-day-month accounting |
| You forgot the inclusive +1 | A booking or trip is always one day short | Add 1 when both ends count |
| You used DATEDIF for a simple count | It works, but it is undocumented and errors on reversed dates | Use subtraction or DAYS for a plain day count |
| You typed the dates as text | The subtraction returns #VALUE! | Enter real dates, or use DATEVALUE to convert them |
What is the formula for days between two dates in Excel? =B2-A2 — the end date minus the start date — or =DAYS(B2, A2), or =DATEDIF(A2, B2, "D"). All three give the same number of days.
Why does my answer show as a date instead of a number? The result cell is formatted as a date. Select it, open the format dropdown on the Home tab, and switch it to General or Number.
How do I count days from a date to today automatically? =TODAY()-A2 — TODAY() returns the current date and recalculates every day, so the count grows by one each morning without retyping.
How many days are between 5 January and 5 March 2026? 59 days — 26 days left in January, 28 in February, and 5 in March. Inclusive, counting both ends, it is 60 days.
How do I get weeks between two dates? Divide the days by 7: 59 days is 8 weeks and 3 days, 267 days is 38 weeks and 1 day.
Why does DATEDIF return #NUM!? The start date is after the end date — DATEDIF errors where subtraction and DAYS return a negative number. Swap the dates, or use subtraction instead.
What is the difference between DAYS and DATEDIF? DAYS takes the end date first and returns the same count as subtraction. DATEDIF takes the start date first, errors on reversed dates, and is the only one that also gives years, months, and the mixed breakdown.
That is the days between dates formula in Excel: a date is a number, so the days between two dates are a subtraction — =B2-A2, or =DAYS(B2, A2) with the end date first, or =DATEDIF(A2, B2, "D") with the start date first. On the dates in this guide, all three agree every time: 5 January to 5 March 2026 is 59 days, 10 March 2021 to 27 February 2026 is 1,815 days — 4 years, 11 months and 17 days — and a project that started on 2 March 2026 is 267 days old on 24 November 2026. Remember the two things that catch everyone once: if the answer shows as a date from 1900, the answer is right and the format is wrong — switch the cell to General — and if your count is always one short, add 1, because subtraction counts the gap, not the ends. From here, the next functions worth learning are the ones this one sits next to — the working days between dates for the count without weekends, the calculate age guide for DATEDIF’s year breakdown, and the full learning order for the whole site is on the Excel Formulas hub and the Date & Text topic page.
Learn how to split first and last name in Excel: TEXTSPLIT, LEFT and FIND formulas, middle names, Flash Fill and Text to...
Read Guide →Learn how to get the month and year from a date in Excel: month name, month number, quarter, first and last day...
Read Guide →Learn how to extract text after a character in Excel: TEXTAFTER and TEXTBEFORE, the last word, and the older FIND method.
Read Guide →