Some of these formulas require that you have the Analysis ToolPak Add-in installed.
To install this Add-in go to [color green]Tools->Add-Ins...[/color] and select the Analysis ToolPak from the list.
Let's start with the simple formulas.
[color red]Please note that there are various ways to get the same results below..[/color]
Return the current date (w/ or w/o current time):
w/ time [color blue]=NOW()[/color]
w/o time [color blue]=TODAY()[/color]
[color red]NOTE: These formulas are "Volatile". This means that they recalculate EVERY time the workbook recalculates.[/color]
Excel stores it's dates as sequential serial numbers so they can be used in calculations. (i.e. January 1st, 1900 = 1, and January 1st, 2004 = 37987 because it's 37,986 days after January 1st, 1900.
You can test this by entering this formula: [color blue]=DATEVALUE(TODAY())[/color]
Return the day of the month for a specific date:
[color blue]=DAY(TODAY())[/color]
Return the day of the week for a specific date:
[color blue]=WEEKDAY(TODAY())[/color] [color green]For this to work you have to set the cell format to Custom format "dddd"[/color]
[color blue]=TEXT(WEEKDAY(TODAY()),"dddd")[/color] [color green] ' Returns text (i.e. no calculation allowed)[/color]
[color red]The [/color][color blue] WEEKDAY()[/color][color red] formula's syntax is as follows:[/color]
The first value is the date. For the second value, it depends on how the calendar is in your country.
[color blue]=WORKDAYS(A1,B1,Holidays)[/color]
[color green]A1 is the start date and B1 is the number of days in the period.[/color]
[color red]A few of the previous formulas use a Named Range in Excel that contains the dates for holidays, create one using the holidays from your region and the formulas will work.[/color]
DATEDIF() Syntax & Examples
Another way to calculate dates in Excel, is a function that has absolutely no documentation in the Excel Help File (except Excel 2000). This function is the [color blue]DATEDIF()[/color] function. It originates from Lotus 1-2-3.
The [color blue] DATEDIF()[/color] function uses the following syntax:
[color red]The start date has to be less than the end date, or else the function will return an error.[/color]
The following are the Unit Codes for the [color blue]DATEDIF()[/color] function:
1. "y" - The years in a period
2. "m" - The months in a period
3. "d" - The days in a period
4. "md" - The difference between the days in a period, w/o the months and years
5. "ym" - The difference between the months in a period, w/o the days and years
6. "yd" - The difference between the days in a period, w/o the years
To calculate the number of years between two dates
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.