Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 10 Working with Dates & Times Microsoft Excel 2003.

Similar presentations


Presentation on theme: "Chapter 10 Working with Dates & Times Microsoft Excel 2003."— Presentation transcript:

1 Chapter 10 Working with Dates & Times Microsoft Excel 2003

2 Date Serial Numbers To Excel, a date is just a number that represents the number of days since January 0, 1900. –A serial number of 1 represents the date January 1, 1900. To view a date serial number, format the cell as a date using the Format Cells dialog box.

3 Date Formats Normally, you enter a date using any recognized date formats (see Table 10-1) Excel –converts your entry into the corresponding serial number (which it uses for calculations) –applies the default date format to the cell so it displays as an actual date rather than the serial number. –Usually the default date format is your system’s short date format.

4 Time Serial Numbers To work with time values, extend the excel date serial number system to include decimals or fractional days. Noon at June 1, 2004 is represented by the serial number 38139.5 –One minute = 0.00069444 –One second = 0.00001157 –See Table 10-2 for other times of day serial numbers.

5 Time Serial Numbers A time value without a date gets a date serial number of 0, which corresponds to the non-day January 0, 1900. 0.81250000 = 7:30:00 PM If a time is entered that exceeds 24 hours, Excel increments the associated date for the time accordingly: 27:00:00 = 1.12500000

6 Formatting Dates and Times You can format the cell to display –The date part only –The time part only –Both the date and the time parts Use the Format Cells dialog box to format dates and times to your desired format, or to create a custom format.

7 Problems with Dates Excel’s Leap Year Bug –Although the year 1900 was not a leap year, Excel treats it as such. –Treats February 29, 1900 as a date Pre-1900 Dates –Must enter the dates into a cell as text. –Can’t perform any manipulation on dates entered as text. –Can use the Add-in “Extended Date Functions” included on your CD. Inconsistent Date Entries –Two digit year entries behave according to rules determined by your version of Excel. (see pg 197).

8 Date & Time Related Functions See Table 10-4 in your book for all of Excel’s date-related functions. See Table 10-5 in your book for all of Excel’s time-related functions.

9 Displaying the Current Date TODAY() –Updated whenever the worksheet is calculated. To enter a date stamp, where the date will not change: –Ctrl+; (press the control key and the semi- colon)

10 Displaying Any Date DATE() –Creates a date –3 arguments: the year, the month, the day. =DATE(A1, A2, A3) =DATE(2006, 2, 30) results in the date March 2, 2006

11 Entering a Date (DATE) Entering the DATE function The calculated result is displayed as both a serial value and as a formatted date value The function expression is built as you enter arguments into the dialog box

12 Displaying Any Date DATEVALUE() –Converts a text string that looks like a date into a date serial number. –1 argument: a text string (must be enclosed in quotes) =DATEVALUE(“January 2, 2006”) =DATEVALUE(“03/05/2006”) results in the date March 2, 2006

13 Extracting Date Values (Day, Month, and Year) Entering the DAY, MONTH, and YEAR functions The active cell, F12, is named “myDate” as shown in the Name box

14 Generating a Series of Dates Can use a formula instead of Excel’s AutoFill feature to create a series of dates. –Can change the first one and the others will update automatically. Series of dates separated by 7 days =A1+7 Series of dates separated by one month =DATE(YEAR(A1), MONTH(A1) + 1, DAY(A1) Series of dates separated by one year =DATE(YEAR(A1)+1, MONTH(A1), DAY(A1)

15 Converting a Non-Date String to a Date Use a formula that parses the text value. i.e. if A1 holds 20060101 =DATE(LEFT(A1,4),MID(A1,5,2),RIGHT(A1,2))

16 Number of Days Between Two Dates Can use simple subtraction Fence Post: EndDay – StartDay + 1 NETWORKDAYS function –Calculates the number of workdays between two dates –Uses optional range of cells that include holidays to exclude those dates as well WORKDAY function –Available only with the Analysis ToolPak. –Opposite of the NETWORKDAYS function.

17 Number of Years Between Two Dates Use the YEAR function to extract the year from each date. =YEAR(A1) – YEAR(A2) DATEDIF function –Calculates the number of days, months, or years between two dates. –3 arguments: (startdate, enddate, code that represents the time unit of interest – see pg 205) –Must be entered manually – not available in function dialog box.

18 Other Date Formulas Determining the Day of the Year (Julian Date) =A1-DATE(YEAR(A1), 1, 0) Determining the number of days remaining in the year after a particular date (in cell A1) =DATE(YEAR(A1), 12, 31) – A1 To convert a particular day of the year (B1) to an actual date in a specified year (A1) =DATE( A1, 1, B1)

19 Other Date Formulas Determining the day of the week Use the WEEKDAY function =WEEKDAY(DATE(2006, 1, 1)) Determining the date of the most recent Sunday =TODAY()-MOD(TODAY() -1, 7) Pg 207 – Determining the first day of the week after a date Pg 207 –Determining the nth occurrence of a day of the week in a month Pg 208-210 – Determining Holidays

20 Calculating the Day of the Week (WEEKDAY) Displaying the weekday of a date value Using a customer number format to display the weekday name

21 Calculating the Day of the Week (WEEKDAY) Selecting the WEEKDAY function

22 Time-Related Functions NOW() –Displays the current date and time NOW() – TODAY() –Displays the current time without an associated date Displaying any time where A1 holds the hour, B1 holds the minute, and C1 holds the seconds. =TIME(A1, B1, C1)

23 Calculating Dates (NOW and TODAY) Searching for a function “to display the current time” Type your request for a function here and then click the Go command button to perform the search The results of the function search appear in this list box. Click on a function to display its description below the list box.

24 Calculating Dates (NOW and TODAY) Displaying the function categories

25 Calculating Dates (NOW and TODAY) Function Arguments dialog box for the NOW function The NOW() function is entered into cell B20 without any arguments.

26 Time-Related Functions TIMEVALUE() –Converts a text string that looks like a time into a time serial number. =TIMEVALUE(“5:45 AM”) Pg 214-215 – Summing times that exceed 24 hours Pg 217 – Converting from military time Pg 217-218 – Converting decimal hours, minutes, or seconds to a time.

27 Calculating Elapsed Time (TIME)

28 Time-Related Functions Pg 218 – Adding hours, minutes or seconds to a time Pg 219 – Rounding time values Pg 219-220 – Working with non-time-of- day values

29 Calculating Dates (NOW and TODAY) Formatting the display of the current time


Download ppt "Chapter 10 Working with Dates & Times Microsoft Excel 2003."

Similar presentations


Ads by Google