How to Subtract a Date From Today in Excel

Even though Microsoft Excel spreadsheet software was created for numerical calculations, we often have dates within our data, and we need to calculate elapsed days, weeks, months, years, or sometimes just working days.

Fortunately, Excel has you covered pretty well.

All of these operations are easily possible, and we can calculate anything related to dates – be in working days, months, or years, using a plethora of Excel functions and a number of ways.

How Are Dates Stored in Microsoft Excel

When you type a date in Excel, it appears as a Date. In the format section, you will even see it as a Date Format. But strangely, Microsoft Excel has no special way of determining dates as a Date data type. So a Date value is stored as a number in Excel. This trend was started by Lotus 1-2-3, the spreadsheet that predates Microsoft Excel.

So when you type a date in Excel, it is converted to a number – a serial number to be exact. This serial number starts from 1-March-1900. This first date was numbered 1, and then subsequent dates were calculated by adding days to this number.

If you don’t believe me, simply type a date and then change its type from Date to General. You’ll see a large number appear instead of the date. Something like 44762. The serial number you get might be higher or lower than this number, depending on the date you have keyed in.

While you may be puzzled by the fact that dates are being stored as serial numbers in Excel, it is in fact a boon for us.

Now we can perform arithmetic with the dates, as they are not really “dates” but rather “numbers”.

Do take note that based on your regional settings, you might see the date pre-formatted as DD/MM/YY or MM/DD/YY.

Further, you might see a two-digit year or a four-digit year. To tweak the way dates appear, you can change the format by picking up a suitable Custom Format.

How To Find Today’s Date

You can find the current date by using the Excel function TODAY. This is an empty function and does not take any arguments. Simply write =TODAY(), and you will get today’s date.

This makes it easy to make other dates, like tomorrow and yesterday, with the help of the today function.

Today =TODAY()

Tomorrow =TODAY() + 1

Yesterday = TODAY() – 1

Similarly, you can add or subtract any number of days from a starting date by using this method. Do try it out on any given date.

If you want to see the date with time, you can use the equivalent time function of Excel – NOW()

When you use NOW(), you get the date, along with the current time. Both the TODAY() & NOW() are dynamic functions, and every time any other function is evaluated in Excel, the Today & Now functions would get updated too to the latest current date and time.

How to Subtract a Date from Today

Instead of making future or past dates, you might already have a date, like the date of birth, and now you want to find the age of a person.

This can be achieved by subtracting the second date from the first date. So in our case, we will subtract the date of birth from Today’s date.

As an example, if the cell A2 contains the date of birth and the cell B2 contains Today’s date, then we can compute the difference between the two dates in cell C2 with the following formula:

=B2 – A2

You can try this on a blank Excel sheet.

The above formula will result in a number being shown in cell C2. The number obtained is the number of days difference between the two dates. Keep in mind that whenever you use this formula, you may receive a positive value or a negative value, depending on how you subtract dates.

If you subtract the earlier date from the current date, you will get a positive number, and when subtracting the current date from a previous date will give you a negative number.

How to Find the Age of a person in Excel

Calculating the number of days elapsed between 2 dates and getting a number is good, but if you want to calculate the Age of a person, having the difference in days isn’t much useful. We now need to convert the elapsed days into number of years, the number of months and the number of Days.

Calculating these three things manually can require a lot of calculations, using the Day functions of Excel. We can use many different ways to calculate the difference in Excel dates.

There’s an absolute gem of a function called the DATEDIF function in Excel, which is actually meant for subtracting dates, and find the difference between dates in elapsed days. It can tell you the difference in Years, Months & Days, depending on the third argument provided within the function.

I generally prefer this easy way to find the difference in days between specific dates. Datedif takes the following arguments.

DATEDIF(start_date, end_date, unit)

In this function, the first argument is the start date. The second argument is the end date or the due date. The unit can be anything from the list below.

“Y” returns the number of complete years in the period.

“M” returns the number of complete months in the period.

“D” returns the number of days in the period.

“MD” returns the difference between the days in start_date and end_date. The months and years of the dates are ignored.

“YM” returns the difference between the months in start_date and end_date. The days and years of the dates are ignored.

“YD” returns the difference between the days of start_date and end_date. The years of the dates are ignored. Only the difference between the dates without the years, is calculated.

So to calculate the complete years between any 2 selected dates, we can use the DATEDIF function in the third blank cell. The date_of_birth cell references the start date.

The todays_date cell references the cell where we have written =TODAY() to get Today’s date.

=DATEDIF(date_of_Birth, todays_date, “Y”)

To calculate the complete months after the years, we can use:

=DATEDIF(date_of_Birth, todays_date, “YM”)

And to calculate the complete days between 2 dates ignoring months and years, we can use:

=DATEDIF(date_of_Birth, todays_date, “MD”)

And to calculate the exact age, we can then combine the 3 functions, using the CONCATENATE Method, or using the & operator.

In the simple formula below, we calculate the complete age of a person born on 6-December-1966, and Today’s date being 30-July-2022.

You can copy and paste this formula and then hit the Enter key.

=DATEDIF(date_of_birth, todays_date, “Y”) & ” Years, ” & DATEDIF(date_of_birth, todays_date, “YM”) & ” Months and ” & DATEDIF(date_of_birth, todays_date, “MD”) & ” days”

For the formula result, you will see

How to Separate Day, Month & Year from any Date

There are several Date & Time Functions in Excel, that can be very clinical and separate out some components of the date, like the days, months or years, as desired.

To get the Day, we use the Day Function:

=DAY( TODAY() ) gives the date like 30

=MONTH( TODAY() ) gives the month as a number from 1 to 12.

As an example, the month function can be helpful in finding out the month of the invoice date. If you have multiple dates in a table, you can simply pull the fill handle and get Excel to calculate the months of all dates.

=YEAR( TODAY() ) gives the year of the year, like 1966 or 2022. Future values of the Year function will yield 2023, 2024 etc.

Calculating Working Days Between 2 Dates

The DateDif function calculates the number of days between two days. While it is suitable for age, sometimes you want to calculate working days, excluding the weekends.

So you may want to exclude Saturday or Sunday or both, or any other weekday from the calculation and work with only business days as the total number of days elapsed.

In this case, you can use the NETWORKDAYS() function of Microsoft Excel.

Here’s the step-by-step detailed article on how to calculate the difference between two days without the weekends.

Find Age in Years From the Date of Birth in Excel

How to Center a Title in Excel (With and Without Merging)

To center a title in Excel, type it in the first cell, select the cells it should span, and either click Merge & Center (Home tab) or choose Center Across Selection in Format Cells. Both look the same on screen, but Center Across Selection keeps your cells separate, so sorting, filtering and copying still work. That is the method I recommend.

Not sure which one you need? Use this quick guide, then jump to the section you want.

I want to center… Best method Shortcut (Windows)
A title across several columns (no merging) Center Across Selection Ctrl + 1, then Alignment tab
A title across several columns (merged) Merge & Center Alt, H, M, C
Text inside a single cell Center button Alt, H, A, C
Text up-and-down in a tall cell Middle Align Alt, H, A, M
A chart title Chart Title > Above Chart –
The whole sheet on a printed page Page Setup > Margins > Center on page –
Text in a printed header or footer Custom Header, Center section –

Steps are for Microsoft 365 and Excel 2016 or later. Older versions have the same commands, with small differences in tab names.

Title centered across a table in Excel

Merge & Center vs Center Across Selection

Merge & Center joins the selected cells into one big cell. Center Across Selection only changes how the text is displayed. The cells underneath stay separate.

Merge & Center Center Across Selection
Cells merged? Yes No
Contents of the other cells Deleted Kept (but cells to the right of the title must be empty for it to centre)
Sort and filter Problems with merged cells Works normally
Inside an Excel Table Button is greyed out Use it on a row above the Table
Where is it Home tab button Format Cells dialog

My rule: use Center Across Selection for anything you will sort, filter, copy or reuse. Use Merge & Center only for a finished report or dashboard that nobody will sort.

Method 1: Center Across Selection (recommended)

This centers your title over several columns without merging a single cell.

  1. Type the title in the leftmost cell, for example A1.
  2. Select the cells the title should span, for example A1:F1. The cells to the right of the title must be empty.
  3. Press Ctrl + 1 (Cmd + 1 on Mac) to open Format Cells. Or right-click and choose Format Cells.
  4. Stay on the Alignment tab. Under Horizontal, change General to Center Across Selection.
  5. Click OK.

Center Across Selection in the Format Cells dialog in Excel

Click the title and look at the formula bar. The text lives in A1 only, and B1 to F1 are still ordinary cells. That is why sorting and filtering keep working.

Tip: If the title does not centre, check that the cells to its right are truly empty. Even a stray space stops it.

Method 2: Merge & Center

This is the quickest method, and fine for a one-off report.

  1. Type the title in the first cell of the range.
  2. Select the cells to span, for example A1:F1.
  3. On the Home tab, in the Alignment group, click Merge & Center. Keyboard: Alt, H, M, C.

Merge and Center button on the Home tab in Excel

Excel keeps only the text in the top-left cell. Anything in the other selected cells is deleted, so copy it elsewhere first. Click the small arrow beside the button if you want Merge Across or Merge Cells (merge without centering).

If you select several rows, centered text sits in the bottom row of the merged cell. Fix that with Middle Align, covered next.

How to Center Text in a Single Cell

For one cell, no merging is needed. Select the cell and click Center in the Alignment group on the Home tab. Keyboard: Alt, H, A, C on Windows, or Cmd + E on Mac.

The same group has Left and Right alignment buttons if you change your mind. To center a whole row of column headings, select the header cells and click Center once.

How to Center a Title Vertically (Middle Align)

In a tall row, text sits at the bottom by default. Click Middle Align (Alignment group, Home tab) to put it halfway up the cell. Keyboard: Alt, H, A, M. Combine it with Center and the title sits exactly in the middle, horizontally and vertically.

Middle Align button in Excel

How to Center a Title Over a Table

A title above a table is just a cell above the table’s first column. Use Center Across Selection on the row above the table, spanning the same columns as the table.

Do not merge cells inside an Excel Table. The Merge & Center button turns grey when the selection is part of a Table. Keep the title in a row above the Table instead, and your filter buttons and sorting stay intact. Want to sort a list safely? See Re-Sorting a List or Table in Excel.

How to Unmerge Cells in Excel

  1. Select the merged cell.
  2. On the Home tab, click Merge & Center again (it works as a toggle), or open its arrow and choose Unmerge Cells.

The text drops back into the left cell. To switch to the cleaner method, select the same range again and apply Center Across Selection as in Method 1. Pressing Ctrl + Z straight after merging also undoes it.

To find every merged cell on a sheet, press Ctrl + F, click Options > Format, tick Merge cells on the Alignment tab, then click Find All.

How to Center a Chart Title in Excel

New charts usually place the title in the top centre automatically. If yours is missing or has moved:

  1. Click the chart.
  2. Click the green + (Chart Elements) button at the top right, or go to Chart Design > Add Chart Element.
  3. Tick Chart Title, then pick Above Chart. The title sits centered above the plot area.
  4. Click the title and type your own text.

Centered Overlay in the same menu places the title over the chart instead of above it. If you dragged the title off-centre, choosing Above Chart again snaps it back.

Adding a chart title above the chart in Excel

Excel chart with the title centered

Want the title to update by itself? Read Dynamic Chart Titles in Excel. More chart polish tips are in Creating Beautiful Excel Charts for Business Presentations.

How to Center a Sheet on the Printed Page

Your title may look centered on screen but print off to the left. To center the whole printout:

  1. Go to the Page Layout tab.
  2. Click the small arrow (dialog launcher) in the Page Setup group.
  3. Open the Margins tab.
  4. Under Center on page, tick Horizontally, Vertically, or both.

Check it in Print Preview (Ctrl + P).

How to Center Text in a Header or Footer (Print)

Every printed header and footer has three boxes: Left, Center and Right. “Center header section” simply means the middle box.

  1. Go to Insert > Header & Footer. Excel switches to Page Layout view.
  2. Click the center box at the top (header) or bottom (footer) of the page.
  3. Type your text, or use the Header & Footer tab to insert the sheet name, file name, date or page number.

Prefer a dialog? Go to Page Layout, open the Page Setup launcher, choose the Header/Footer tab, then Custom Header or Custom Footer. Type in the Center section box. This route also lets you apply the same header to several sheets at once.

Custom header with file name in the center section in Excel

For example: file name in the left section, today’s date in the centre, page number in the right section. Print Preview shows the result.

Note: set up headers and footers in the Excel desktop app. Microsoft’s instructions for them cover the desktop versions.

Excel for Windows, Mac and the Web

  • Windows: everything above applies. Shortcuts: Ctrl + 1, Alt, H, A, C.
  • Mac: same buttons on the Home tab. Format Cells is Cmd + 1, and Center is Cmd + E. The Alt key sequences are Windows only.
  • Excel for the web: Merge & Center is on the Home tab. If you cannot find Center Across Selection in the web version, open the file in the desktop app to apply it.

Want the full list of keys? See Microsoft Excel Shortcuts.

Troubleshooting

Merge & Center is greyed out

You are either editing a cell (press Enter or Esc first), or the cells are inside an Excel Table. Convert the Table to a range (Table Design > Convert to Range), or put the title in a row above the Table.

I cannot sort my data

Merged cells block sorting. Unmerge them, then use Center Across Selection instead. Also see How to Freeze Top Rows and Columns to keep headings visible while you scroll.

Center Across Selection does nothing

Make sure the title is in the leftmost cell and the cells to its right are empty. A space or a formula returning “” can also interfere.

My text disappeared after merging

Excel keeps only the top-left cell. Press Ctrl + Z immediately to get it back.

Want to format Excel reports like a pro? Our Excel for Beginners course covers formatting, alignment and the shortcuts that save hours.

Frequently Asked Questions

How do I center a title in Excel?

Type the title in the first cell, select the cells it should span, then use Merge & Center on the Home tab or Center Across Selection in Format Cells. Center Across Selection is better because it does not merge cells.

What is the best way to center a title over the width of a section of a financial model?

Use Center Across Selection from the Format Cells menu (Alignment tab, Horizontal). It centers the title across the section without merging cells, so sorting, filtering and copying still work. The custom header’s center section is for printed pages, and Merge & Center merges the cells.

How do I center a header in Excel?

It depends on what you mean. For column headings, select the cells and click Center on the Home tab. For text printed at the top of every page, use Insert > Header & Footer and click the center box.

Where is the center header section in Excel?

It is the middle of the three boxes (Left, Center, Right) in Page Layout view and in the Custom Header dialog. Find it under Insert > Header & Footer or Page Layout > Page Setup > Header/Footer tab.

What is the shortcut to center text in Excel?

Press Alt, H, A, C in Windows to center the contents of the selected cells. On Mac, press Cmd + E. Merge & Center is Alt, H, M, C.

Why is Merge & Center greyed out?

Either you are still editing a cell, or the cells are part of an Excel Table. Press Esc, or convert the Table to a range first.

How do I center a title across columns without merging?

Select the cells, press Ctrl + 1, go to the Alignment tab and set Horizontal to Center Across Selection. The title is centered but each cell stays separate.

How do I center text vertically in Excel?

Select the cells and click Middle Align on the Home tab (Alt, H, A, M). Combine with Center to put text in the exact middle of the cell.

How do I center a chart title in Excel?

Click the chart, open Chart Elements (the + button), tick Chart Title and choose Above Chart. It is placed at the top centre of the chart.

Cheers,
Vinai Prakash
Founder & Master Trainer, ExcelChamp.net

Find Age in Years within Microsoft Excel [Video Tutorial]

Wondering How To Find the Age in Years from Date of Birth, in Microsoft Excel?

See multiple ways to calculate Age in Excel from any date of birth.

This simple, step-by-step tutorial on finding the age in Excel from date of birth or any other date, work on Microsoft Office 365, Microsoft Excel 2019, Excel 2016, Excel 2013, Excel 2010, Excel 2007 & Excel 2003 too.

We cover Microsoft Excel Functions & Formulas that allow you to calculate the following things in Excel:

  1. Find the age in Years
  2. Find the Age in Months
  3. Find the Age in Days
  4. Finding the exact age in Years, Months & Days.
  5. Combining Years & Months to create a Text String the way we want.

Here’s how to calculate the number of years since the date of birth

Not only the years we can also calculate the months. I will show you multiple techniques to calculate the age in years, months & days.

If you want a whole number or you want the age as a fraction, there are so many ways to do it.

What we want to calculate is the age in years –  something like Age is 55 years. Or Age is 55.56 years.

Before we start i want to highlight to you that the date of birth that you are using should be a date field so you can select it and make sure the formatting is not General or text, but it should be set as a short date or any kind of date.

To calculate the years,  the formula is extremely simple. We will be using the DATEDIF function of Excel.
=DATEDIF(DateofBirth, TODAY(), “Y”)

Similarly, we can calculate the age in months too.

=DATEDIF(DateofBirth, TODAY(), “M”)

This will result in the number of months from the date of birth to today’s date. You might see a huge number like 666 here.

But you may not want this.  Perhaps we only want how many months after the 55 whole years have elapsed.

In this case,  we modify the formula from only “M” to “YM”

=DATEDIF(DateofBirth, TODAY(), “YM”)

YM means it is only the months after the completed years. By doing this we can see that only six months have elapsed after 55 years.

Finally, we only need the days that have elapsed after the completed months in the age.

=DATEDIF(DateofBirth, TODAY(), “D”)

This will tell you that 20,000 days have passed from the date of birth, but, of course, we don’t want this.

So you change D to MD. The “MD” tells Excel to calculate how many days after the month have elapsed. 

As you can see, we have the age calculated in different cells – the age is 55 years 6 months and 9 days exactly till today.

If you wish to see a complete combined date, you can use the CONCAT function to combine multiple formulas, or use the & to combine text as well.

As an example, we can write

=CONCAT(DATEDIF(dateofbirth,TODAY(),”Y”),” Years, “,DATEDIF(dateofbirth,TODAY(),”YM”),” Months & “,DATEDIF(dateofbirth,TODAY(),”MD”),” Days”)

For a DateofBirth date of 6-December-1966, it generates, 55 Years, 6 Months & 28 Days.

Hope you find this DATEDIF function quite handy for such use. Do give it a try and let us know how you use it.

Cheers,
Vinai

Recommended Reading for Next Steps:

  1. Using Date & Time Functions in Excel
  2. Difference Between 2 Dates, Without the Weekends