How to calculate age and remaining days using Excel date formula

Use date functions such as DATEDIF, TODAY, and NETWORKDAYS to calculate age from birth date, calculate remaining days from expiration date, and handle common issues such as expired, fixed statistical days, and date formats.

Key points of this article

  • The age in years is calculated using DATEDIF(date of birth, TODAY(), "Y"), which will be automatically determined based on the anniversary, so there is no need to manually compare the month and day.
  • The remaining days are calculated by subtracting TODAY() from the deadline. A positive number indicates how many days are left, and a negative number indicates it has expired. IF can be used to change the display prompt.
  • When the results need to be fixed, replace TODAY() with a separate statistical date cell to facilitate archiving and comparison.
  • Use NETWORKDAYS when counting only working days, it will skip weekends and pass in the holiday area.
  • When the result is displayed as a string of numbers, it is most likely a cell format problem. Just change it to date format. The formula itself is usually correct.

Many people record their birth date or contract expiry date in a spreadsheet, but have to rely on hand calculations or open a calculator every day to update their age and remaining days. In fact, Excel's date function can automatically complete these calculations. After the formula is written and filled downward, the entire column will be updated accordingly. This article is intended for readers who often work on personnel lists, contract ledgers, and project schedules. It explains how to use formulas to calculate age, how to calculate the number of days left until the deadline, and how to troubleshoot when the results are incorrect.

After reading this, you should be able to write the age formula and remaining days formula directly in your own table, know where to change to a fixed date, and be able to judge whether a result is really wrong. This does not involve the calculation of the difference between two fixed dates. In that case, you can directly subtract the date. This article focuses on the "based on today" and "based on age rules" algorithms.

How to use date function to calculate age and remaining days? One sentence conclusion

Conclusion: Use DATEDIF with TODAY() for the whole age, and directly subtract TODAY() from the deadline for the remaining days. When the result needs to be fixed, change it to the statistical date cell.

your situationRecommended practicesreason
Only the whole age is requiredUse DATEDIF(date of birth cell,TODAY(),"Y")Automatically calculate based on anniversary, add one year after your birthday, no need to manually compare months
Calculate age to a fixed dateReplace TODAY() with the cell where the statistical date is locatedThe results will not change every day, suitable for statistical reports and archiving
I just want to know how many days are left before the deadlineSubtract TODAY() from due date cellsDirectly, a positive number is the number of days remaining, a negative number indicates it has expired
Need to distinguish between expired situationsUse IF to judge and then display the resultAvoid incomprehensible negative numbers in tables
Only working days are countedUse NETWORKDAYS(TODAY(), due date cell)Automatically skip weekends, and holidays will be skipped after passing in the holiday area

Before you start: Confirm these points first

Before you start writing the formula, confirm the following things first, otherwise the formula may be calculated correctly, but the result is not what you want.

  • The date is not a real date. In Excel, the real date is a number, it is just displayed in date format. If the date you copy from a web page or PDF is left-aligned, most likely text, the formula will report an error or get wrong results. In this case, you can re-enter or use the column separation function to perform unified conversion.
  • Whether "today" should change with time. TODAY() will get today's date every time the table is opened, and the age and remaining days will change accordingly. If you want to take a snapshot of a certain day, such as statistics as of the end of the month, you should use a fixed statistical date cell, otherwise the results will all change when you open the next month.
  • Which rule is used to calculate age? Most scenes are calculated based on the anniversary, that is, one year is added after the birthday. If your rule is to subtract by natural years, the formula will be different. You need to confirm the caliber with the user first to avoid mixing the two algorithms in the same table.
  • Whether the deadline includes today. The remaining days are calculated by subtracting today from the cut-off day. If the cut-off date is today, 0 will be displayed. If your rules require that today be counted as a day, you need to add 1 to the formula or write it clearly in the description.
  • Whether weekends and holidays need to be excluded. Contracts and approvals are often calculated in working days. In this case, NETWORKDAYS should be used instead of simply subtracting, otherwise weekends will also be included.

Steps to calculate age and days remaining in Excel

Let's take a personnel and contract table as an example. Suppose column A is the name, column B is the date of birth, and column C is the contract expiration date.

  1. Organize the date column. Enter the date of birth in column B and the due date in column C. Select these two columns and set the cell format to date to ensure that the display is consistent with the numerical value.
  2. Check if the date is valid. Click B2 to see if the date you entered is displayed in the editing column. If it is displayed as a string of numbers, it means the format has not been corrected; if it is left-aligned after input, it means it may be text and needs to be re-entered.
  3. Write the age formula in column D. Enter =DATEDIF(B2,TODAY(),"Y") in D2 and press Enter to see the full age. DATEDIF is a date function reserved by Excel. It may not be found in the function list, but it can be used by directly inputting it manually.
  4. Write the formula for the remaining days in column E. Enter =C2-TODAY() in E2. A positive number indicates how many days are left until the deadline, and a value of 0 indicates the deadline on the current day.
  5. Handle expired situations. If you want to display a prompt instead of a negative number after expiration, you can change E2 to =IF(C2>=TODAY(),C2-TODAY(),"Expired"), which makes it easier to see the status at a glance in the table.
  6. Use NETWORKDAYS instead when working days are required. Enter =NETWORKDAYS(TODAY(),C2) in F2, the result will include the starting and ending two days and skip Saturday and Sunday. If there are holidays, you can put the date list in a certain area and pass it in as the third parameter, for example =NETWORKDAYS(TODAY(),C2,H2:H20).
  7. Need to replace TODAY() with a fixed statistical date. Enter the statistical date in a cell above the table (such as G1), and then replace TODAY() in all formulas with $G$1. The age and remaining days will be based on this day and will no longer change with the opening date.
  8. Fill down. Select D2 to F2 and drag the fill handle to the last row. Check whether the results of several rows are consistent with the hand calculation before giving it to others to use.

If the date of birth or contract expiration date is originally in a PDF table, you can first use the PDF export to Excel function of the OmniDoc desktop client (download.omnidoc.top) to convert the table into an editable file, and then calculate it according to the above steps.

Check each item after completion

After writing the formula, do not trust the results directly. It is recommended to check the following aspects one by one.

Check itemsHow to seeWhat to do if there is a problem
Is the result a string of numbers?Days Remaining or Age columns displayed as date-like numbersChange the corresponding cell format to regular or number, and the date column will maintain the date format.
Is the age consistent with the hand calculation?Randomly select two or three rows and manually count by birthdayCheck whether the date of birth was entered in the wrong year or another formula was used incorrectly
Is the positive or negative number of remaining days reasonable?Deadlines that have passed should display a negative number or an expired promptIf no prompt is displayed, check whether the IF judgment is missing
Is there a #VALUE! error?The error usually occurs in cells where the date is textRe-enter the date, or use the column separation function to convert text into dates
Is there a #NUM! error?Commonly seen in DATEDIF when the start date is later than the end dateCheck the order of parameters to make sure date of birth is first and today is last
Does the result change with date?Open it again every other day and see if the value changes.If you need fixed results, use statistical date cells instead of TODAY()

Also, when calculating birthdays for people born in leap years in non-leap years, Excel may handle it differently than you expect. If the table involves people born on February 29, it is recommended to write down the birthday judgment rules clearly in the description, or manually review these lines.

📊 Core comparison

There are three main ways to calculate age and days remaining, and the difference lies in what changes the results are based on.

practiceHow does the result change?Suitable for the scene
TODAY() plus DATEDIF or subtractionIt changes every day you open itDaily reminders, tracking of upcoming due dates
Fixed statistical date cellOnly changes with the modification of statistical dateMonthly reports, quarterly reports, data that need to be kept on file
NETWORKDAYS working day calculationChange with today's date and skip weekends and holidaysContract duration, approval time limit, and scheduling

Which one to choose depends on the purpose of the form. If you just want to read it yourself, TODAY() saves trouble; if you want to send it to others or keep it for records, it is more reliable to fix the statistical day; if it involves rules about working days, you need to use NETWORKDAYS and maintain a holiday list.

❓ Frequently Asked Questions (FAQ)

1. Why is a string of numbers displayed after entering a formula?

This is usually because the cells are formatted incorrectly and Excel displays dates as serial numbers. Select the result column and change the format to regular or number. If the date column itself is displayed as numbers, you need to change the date format back.

2. The DATEDIF function cannot be found. Is it not supported by the Excel version?

DATEDIF is a function reserved by Excel for compatibility with older versions. It is usually not displayed in the list of inserted functions, but it can still be used by entering the complete formula directly into the cell. If the formula is not recognized, check the spelling and brackets for completeness.

3. The deadline has passed, why is the number of remaining days negative?

This is because the formula calculates the expiration date minus today, and the result will naturally be negative when it expires. You can use IF to judge and change the negative number to text such as "Expired", which is good-looking and easy to filter.

4. Can the remaining days be directly displayed as years, months and days?

You can use DATEDIF to get the number of years and months respectively, for example, use "Y" and "YM". However, when "MD" is used for the number of days, the results may be inaccurate in some cases. It is recommended to check several sets of samples before use, and do not rely directly on it.

5. Is there any other way to calculate age without Excel?

Comparisons by birthday and today's date can be done manually or by using a universal online date calculator. No matter what tool is used, it is recommended to check with several sets of data with known results and confirm that the caliber is consistent before batch processing.

📝 Summary

To use Excel function formulas to automatically calculate age and remaining days, the key is to first clarify the date format, calculation caliber and base date. Use DATEDIF for the whole age, and use the cutoff day minus TODAY() for the remaining days. If you need a fixed result, use the statistical date cell, and use NETWORKDAYS for the working day scenario. After the formula is written, remember to check a few lines and check the display format so that the table can be used reliably for a long time.

Open OmniDoc and work with your spreadsheet file

Updated 2026-11-11