Sei sulla pagina 1di 3

DATE Function

Microsoft Excel uses natural numbers to represent a date value as the number of days that have passed since 1/1/1900(serial value is 1) on MS Windo s (or since 1/!/190" on Macintosh) till 1!/#1/999(serial value is !9$%"&$)' (o enter the date of the day no need to )ey it in* clic) and hold the +(,- )ey and clic) on the semi.colon )ey (/) and there is the date' (o enter the time* clic) and hold both the Shift and the +(,- )eys and clic) on the colon )ey (0) and there is the time' Microsoft Excel doesn1t or) ith dates and times* it or)s ith serial numbers (his means that hen you enter 1!/!$/!00" Excel sees #%#"& and if you enter 1!/!&/!00" Excel sees #%#"2' When you enter 1!000000 3M Excel reads 0'$ and if you rite 1!000001 3M Excel reads 0'$00011&' 4t is hen you format the cell 56ormat/+ells5 that you can read dates and times as e humans are accustomed to see them' DATEDIF One note to start. If you go to the menu "Insert/Function" you won't find this function. Excel has forgotten it. Here is how it works. Let's say that you ha e the dates !/!"/#$$% in cell &! and !/!"/#$$" in cell '!( =DATEDIF(A1,B1,"y") will return ! =DATEDIF(A1,B1,"m") will return !# =DATEDIF(A1,B1,"d") will return )"% TODAY and NOW If you enter the formula =TODAY() with the *arentheses in a cell it will show the date at which the s*readsheet was o*ened. Each time that you o*en the s*readsheet the date changes. If you enter the formula =NOW() with the *arentheses in a cell it will show the date and time at which the s*readsheet was o*ened. Each time that you o*en the s*readsheet the date and time change. +he other functions work in con,unction with others of the category or with other functions. Here is what they return when used alone. DAY, MONTH, YEAR -ith a date in &! like !#/!%/#$$% the formulas =DAY(A1). =MONTH(A1) and =YEAR(A1) will return !%. !# and #$$%. SECOND, MINUTE, HOUR -ith a +I/E in &! like !()!(0%1/ the formulas =SECOND(A1). =MINUTE(A1) and =HOUR(A1) will return !. )! and 0%. WEEKDAY If the date in &! is !/!"/#$$" and it is a /onday the formula =WEEKDAY(A1) will return #. For most users day ! is 2unday. 3heck what your system says 4ecause in some cases day ! is /onday.

&0 (sixty minutes) &0 (sixty seconds) &0 min 7 #&00 sec (&0 secs 8 &0 mins) !" hr (t enty four hours) 7 1""0 min (&0 mins 8 !" hours) %&"00 (!" hours 8 &0 mins 8 &0 secs) Note: If you develop a time management application don't go through the trouble of working with clock time. Ask your people to enter either the number of hours worked by projects or the number of minutes then work with regular numbers. Much easier.

SENARIO / E CERCISE
DATEDIF, NOW, AND and IF /y client wanted a s*readsheet that would tell her when it is the 4irthday of an em*loyee. -e created a s*readsheet with the names in column & and the dates of 4irth in column '. In cell 5! was this formula =NOW() that changes date each day. In column 3 we *ut this formula( =IF(AND(DATEDIF(D1,B!,"d")=",DATEDIF(D1,B!,"m")="),"Ann#$%&'a&y","") meaning that if the date difference in days and in months 4etween cell '# and cell 5! is 6ero then show "&nni ersary" else show nothing. -e fine tuned( =IF(AND(DATEDIF(D1,B!,"d")=",DATEDIF(D1,B!,"m")="),"Ha((y Ann#$%&'a&y",IF(DATEDIF(D1,B!,"d"))*,"Ann#$%&'a&y +,m#n-","")) meaning that if the date difference in days and in months 4etween cell '# and cell 5! is 6ero then show "Ha**y &nni ersary" else if the date difference in days 4etween cell '# and cell 5! is smaller than 7 return "&nni ersary coming" else show nothing. 3o*y/*aste the formula a4o e in your s*readsheet. If you want to 4e alerted more that a week 4efore the anni ersary change the 7 for )$ in the formula. +his way you will 4e alerted a month in ad ance.

Date & Time Worksheet Functions in Excel (#ws)


,efer to your 9E-3 (61)file for more information'
DATE DATEVALUE DA, DA,-+.* EDATE Returns the serial number of a particular date syntax: DATE(year, month, day on!erts a date in the form of text to a serial number Example: "DATEVALUE(#$%&&%''#( e)uals &*+&+ on!erts a serial number to a day of the month alculates the number of days bet/een t/o dates based on a +.*0day year Returns the serial number of the date that is the indicated number of months before or after the start date syntax: EDATE(start1date, months( Example: "EDATE(DATEVALUE(#*2%2'%32#(,2( e)uals ++&$4 or *&%2'%32 Example:

"TE5T(EDATE(DATEVALUE(#6anuary#7# 2', 2333#(,2(,#mmmm#( e)uals 8ebruary E9:9;T< <9UR :=;UTE :9;T< Returns the serial number of the last day of the month before or after a specified number of months on!erts a serial number to an hour on!erts a serial number to a minute on!erts a serial number to a month

;ET>9R?DA,- Returns the number of /hole workdays bet/een t/o dates@ NETWORKDAYS(start_date,end_date,holidays) NETWORKDAYS("10/01/1998","12/01/1998","11/26/1998") Result of abo!e is 4+ (.2 days bet/een(@ Also see >9R?DA,@ ;9> -E 9;D T=:E T=:EVALUE T9DA, >EE?DA, Returns the serial number of the current date and time on!erts a serial number to a second Returns the serial number of a particular time on!erts a time in the form of text to a serial number Example: "T=:EVALUE(#&:&4 A:#( e)uals *@2 Returns the serial number of todayAs date on!erts a serial number to a day of the /eeB Example: ">EE?DA,(#&%24%3*C)uotD( e)uals 4 (>ednesday(, similarly Example: "TE5T(#4%2.%3*#, #dddd#( e)uals :onday Returns the serial number of the date before or after a specified number of /orBdays@ This is the opposite of ;ET>9R?DA,@ WORKDAY(start_date,da s,holidays) on!erts a serial number to a year Returns the year fraction representinE the number of /hole days bet/een start1date and end1date

>9R?DA,

,EAR ,EAR8RA

How to Find the Number of Weekdays Between Two Dates


To find the number of weekdays between two dates, where the start and end dates are typed in cells A1 and A2 respectively, follow these steps: 1. Create a new workbook. 2. Type the following data in the workbook:

A1! 0"/2#/9$ A2! 0#/01/98


. !n cell "1, type the following formula:

%NETWORKDAYS(A1,A2)
1,#$1 is the result. NOTE: !f you see #NAME as the result, click Add- ns on the Too!s menu. Click to select the Ana!ysis Too!"ak check bo%, and then click #es if you are prompted as to whether you want to install it.

Potrebbero piacerti anche