ERLANDSEN DATA CONSULTING Excel & VBA Tips   Informasjon på norsk / Information in Norwegian

These pages are no longer updated and are only available for archive purposes.

Click here to visit the pages with updated information.

Calculate with dates

The TODAY()-function returns a serial number for the current date, as long as the computer date and time is set correctly. The serial number is a long integer counting the number of days since 1. january 1900 (serialnumber=1). The cell containing the function must be formatted to display numbers as dates.

Examples :

Formula : Returns :
=TODAY() The date today
=TODAY()+15 A date 15 days later than today
=TODAY()-7 A date 7 days earlier than today

Excel calculates dates including leap years.

If you enter two dates in two different cells, you can perform a calculation with the two dates.
If cell A1 contains the date 24.12.95 and cell B1 contains the function =TODAY(), you can enter the formula =A1-B1 in cell C1 to calculate the number of days until Christmas. Cell C1 must be formatted to display numbers, not dates.

You can enter a date in a cell by using the following separator signs between days, months and years :
a slash (/), a dot (.) or a hyphen (-). The date will be displayed with the preferred date format set in your computers international settings, or with the date format you select in Excel.
If you omit the year when you enter a date, Excel assumes that you want a date in the current year.

 

Document last updated 2000-04-14 12:44:38      Printerfriendly version

 

Erlandsen Data Consulting     http://www.erlandsendata.no/   
Excel & VBA Tips   Copyright ©1999-2017    Ole P. Erlandsen   All rights reserved
E-mail Contact Address