Anda di halaman 1dari 24

Current Date & Time

TODAY
NOW

Creating Dates & Times


DATE
TIME
DATEVALUE
TIMEVALUE

Extracting The Components of a Date


DAY
MONTH
YEAR
WEEKNUM
WEEKDAY

Extracting The Components of a Time


HOUR
MINUTE
SECOND

Performing Calculations with Dates


EDATE
EOMONTH

WORKDAY
DAYS
NETWORKDAYS
YEARFRAC

Date & Time


Returns today's date
=TODAY()
Returns the current date & time
=Now()

g Dates & Times


Returns a date, from a user-supplied year, month and day
=Date(Year, Month, Day) - All Arguments are Compulsory
Returns a time, from a user-supplied hour, minute and second
=Time(hour, Minute, Second) - - All Arguments are Compulsory
Converts a text string showing a date, to an integer that represents the date in Excel's date-time code
=DATEVALUE(date_text)
Converts a text string showing a time, to a decimal that represents the time in Excel
=TIMEVALUE(time_text)

ng The Components of a Date


Returns the day (of the month) from a user-supplied date
=DAY(Serial_Number)
Returns the month from a user-supplied date
=MONTH(Serial_Number)
Returns the year from a user-supplied date
=YEAR(Serial Number)
Returns an integer representing the week number (from 1 to 53) of the year from a user-supplied date
=Weeknum(Serial Number,[return_type])
Returns an integer representing the day of the week for a supplied date
=Weekday(Serial_number,[return_type])

ng The Components of a Time


Returns the hour part of a user-supplied time
=HOUR(Serial_Number)
Returns the minute part of a user-supplied time
=MINUTE(Serial_Number)
Returns the seconds part of a user-supplied time
=SECOND(Serial_Number)

ming Calculations with Dates

Returns a date that is the specified number of months before or after an initial supplied start date
=EDATE(Start_Date,months)
Returns a date that is the last day of the month which is a specified number of months before or after an initial supplie

=EOMONTH(Start_Date,months)
Returns a date that is a supplied number of working days (excluding weekends & holidays) ahead of a given start date
=Workday(Start_date,days,[holidays])
Calculates the number of days between 2 dates (New in Excel 2013)
=DAYS(end_date, Start_date)
Returns the number of whole networkdays (excluding weekends & holidays), between two supplied dates
=NETWORKDAYS(Start_date,end_date,[holidays])
Calculates the fraction of the year represented by the number of whole days between two dates
=YEARFRAC(start_date,end_date,[basis])

ed start date

Excel Store Date as Value for Calculation purposes


Value No 1: January 01, 1900

12/31/1899
01/01/1890

Try and Convert them to V


by Selecting General Form

Using Year as 2 Digits (Avoid Using 2 digits for representing Year)

If the digits are 30 or above, then Excel assumes the digit represents year in 20th Century
If the digits are lower than 30, then Excel assumes the digit represents year in the 21st Century
29
30

1/1/1930
1/1/2029

=DATE (YEAR.MONTH,DATE)
Year Required. The value of the year argument can include one to four digits. Excel interprets the year ar
date system your computer is using. By default, Microsoft Excel for Windows uses the 1900 date system.

Month Required. A positive or negative integer representing the month of the year from 1 to 12
Day
4

Required. A positive or negative integer representing the day of the month from

Arguments Usage Pattern


Year - using four digits for the year argument to prevent unwanted results. For example, "07" could mean
digit years prevent confusion.
Numbers Less than 0 and Greater than 10000, excel returns #NUM! Error Value
Year
108
-5
1899
2036
10000

Month
4
4
5
12
12

Day
19
6
19
15
20

Using Date Function

1899 Gets added to 1900

If year is between 1900 and 9999 (inclusive), Excel uses that value as the year.
Month - Required.
If month is greater than 12, month adds that number of months to the first month in the year specified. For
returns the serial number representing February 2, 2009.

If month is less than 1, month subtracts the magnitude of that number of months, plus 1, from the first mon
example, DATE(2008,-3,2) returns the serial number representing September 2, 2007.
Numbers Less than 0 and Greater than 10000, excel returns #NUM! Error Value
Year

Month

Day

Using Date Function

2001
2012
2014
2016
1956

14
-5
0
32
64

19
6
19
15
20

12 Months gets added as year


5 months gets subtarcted from the year
Zero Value gets subtacted from the year
24 Months gets added as 2 years
60 Months added as 5 years

Day - Required.
If day is greater than the number of days in the month specified, day adds that number of days to the first da
example, DATE(2008,1,35) returns the serial number representing February 4, 2008. (Try)

If day is less than 1, day subtracts the magnitude that number of days, plus one, from the first day of the mo
DATE(2008,1,-15) returns the serial number representing December 16, 2007.
Numbers Less than 0 and Greater than 10000, excel returns #NUM! Error Value
Year
2001
2012
2014
2016
1956

Month
5
7
3
9
11

Day
131
-74
289
460
-800

Using Date Function

Seconds Beyond 60 are convered to Minute/M


Minutes

Exercise
1. Convert the Values into Dates by Applying Format Cells (Use Different Formats)
2. Extract Year from the Date
3. Extract Month from the Date
4. Extract Day from the Date
5. Convert Year, Month and Day to Year using Date Function
6. Convert Date to Date Value

Value

Date

Year

Month

Day

Date

41343
54532
42586
26452
18903
21345
22132
Extract Weeknumber and Weekday from the above Values
WeekNumber

Weekday

Week Number

41343
54532
42586
26452
18903
21345
22132
Default Sunday is 1 as Week Starting

Monday is 1 as Week Sta

ry and Convert them to Values


y Selecting General Format

el interprets the year argument according to the


he 1900 date system.

of the year from 1 to 12 (January to December).


day of the month from 1 to 31.

mple, "07" could mean "1907" or "2007." Four

the year specified. For example, DATE(2008,14,2)

us 1, from the first month in the year specified. For


7.

ed from the year


ed from the year

er of days to the first day in the month. For


(Try)

m the first day of the month specified. For example,

e convered to Minute/Minutes and Added to

Date Value

Week Number

=DATEVALUE(TEXT(I70,"mm/dd/yy"))

Week Day

Monday is 1 as Week Starting

Performing Calculations with Dates


EDATE
EOMONTH
WORKDAY
DAYS
NETWORKDAYS
YEARFRAC

Returns a date that is the specified number of months before or after an initial suppli
=EDATE(Start_Date,months)
Returns a date that is the last day of the month which is a specified number of month
=EOMONTH(Start_Date,months)
Returns a date that is a supplied number of working days (excluding weekends & ho
=Workday(Start_date,days,[holidays])
Calculates the number of days between 2 dates (New in Excel 2013)
=DAYS(end_date, Start_date)
Returns the number of whole networkdays (excluding weekends & holidays), betwee
=NETWORKDAYS(Start_date,end_date,[holidays])
Calculates the fraction of the year represented by the number of whole days between
=YEARFRAC(start_date,end_date,[basis])

EDATE
31-Dec-15
31-Dec-15
11-Dec-15
28-Feb-16
29-Feb-16
29-Feb-16

1
-1
2
12
12
-12

EOMONTH
1-Jan-12
1-Jan-12
1-Jan-12
29-Feb-12
28-Feb-11

9
-12
0
12
12

WORKDAY
Start Date
Holidays

Date after Specified Number of


Working Days
Basis
5 day Week
Includes Hoildays
Excludes Holidays

1/Dec/2015
25/Jan/2015
28/Dec/2015
1/Jan/2016

Date Falling 25 Workdays after 1st Dec 2015


No Holidays
Excluding Holidays Listed in Cells above

DAYS
04/Dec/11
12/Jan/12
01/Jan/15

02/Feb/15

NETWORKDAY
Start Date
End Date
Holidays

1/Dec/2015
4/Jan/2016
25/Jan/2015
28/Dec/2015
1/Jan/2016

Number of Working Days between two dates


Basis
5 day week
With Holidays
Without Holidays
No Holidays
Excluding Holidays Listed in Cells above

YEARFRAC
Start Date:
End Date:

Calculating Fraction of the year

1-Jan-15
###

- US (NASD) 30/360 b
- actual/actual basis
- actual/360 basis
- actual/365 basis
- European 30/360 ba

fore or after an initial supplied start date

a specified number of months before or after an initial supplied start date


(excluding weekends & holidays) ahead of a given start date

Excel 2013)

eekends & holidays), between two supplied dates

mber of whole days between two dates

Time Function
1

Time values are a portion of a date value and represented by a decimal number (for example, 12:00
PM is represented as 0.5 because it is half of a day).
Time
15:55
10:30
12:40
12:00
18:00

Value

Notes:
A number from 0 to 23, representing the hour.
A number from 0 to 59, representing the minute.
A number from 0 to 59, representing the second

Time Syntax Explanation


TIME(hour, minute, second)

The TIME function syntax has the following arguments:


Hour Required. A number from 0 (zero) to 32767 representing the hour. Any value greater than 23 will be di
will be treated as the hour value. For example, TIME(27,0,0) = TIME(3,0,0) = .125 or 3:00 AM.(Try)

Minute Required. A number from 0 to 32767 representing the minute. Any value greater than 5
and minutes. For example, TIME(0,750,0) = TIME(12,30,0) = .520833 or 12:30 PM. (Try)

SecondRequired. A number from 0 to 32767 representing the second. Any value greate
hours, minutes, and seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 or 1

Arguments Usage Pattern

Hour Required. A number from 0 (zero) to 32767 representing the hour. Any value greater than 23 will be di
will be treated as the hour value. For example, TIME(27,0,0) = TIME(3,0,0) = .125 or 3:00 AM.(Try)
Hour
24
55
46
-26
15

Minutes
45
34
54
21
23

Seconds
45
56
32
21
14

Using Time Function

Hours beyond 24 will be added t


will be convered to Time

Negative Numbers in the Hour Format give

Minutes - Required.
Second Required. A number from 0 to 32767 representing the second. Any value greater than 59 will be conv
seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 or 12:33:20 AM (Try)

Second Required. A number from 0 to 32767 representing the second. Any value greater than 59 will be conv
seconds. For example, TIME(0,0,2000) = TIME(0,33,22) = .023148 or 12:33:20 AM (Try)
Hour
24
55
46
56
15

Minutes
67
125
326
-21
545

Seconds
45
56
32
21
14

Using Time Function

Minutes Beyond 60 are convered


to Hours.

Seconds - Required.
If day is greater than the number of days in the month specified, day adds that number of days to the first day in
DATE(2008,1,35) returns the serial number representing February 4, 2008. (Try)
Hour
24
55
46
34
15

Minutes
45
34
54
21
23

Seconds
451
567
3222
-32
234

Using Time Function

Seconds Beyond 60 are convered


Added to Minutes

Exercise
1. Convert the Values into Time
2. Convert the Time to 24 Hour Format
3. Extract the Hour from the Value
4. Extract Month from the Value
5. Extract Seconds from the Value
6. Convert to Hours, Minutes and Seconds using Time Function
7. Convert Time to Time Value

Value
0.462
0.866
0.928
0.211
0.124
0.054
0.323

Time (12)

Time (24)

Hour

Minutes

Seconds

Time

senting the hour.


senting the minute.
senting the second

ater than 23 will be divided by 24 and the remainder


00 AM.(Try)

ny value greater than 59 will be converted to hours


12:30 PM. (Try)

econd. Any value greater than 59 will be converted to


(0,33,22) = .023148 or 12:33:20 AM (Try)

ater than 23 will be divided by 24 and the remainder


00 AM.(Try)

ond 24 will be added to day and residual


nvered to Time

the Hour Format gives #NUM! Error

er than 59 will be converted to hours, minutes, and


y)

eyond 60 are convered to Hour and Added

days to the first day in the month. For example,

eyond 60 are convered to Minutes and


Minutes

Date Value
=TIMEVALUE(TEXT(H75,"hh:mm:ss"))

When I enter dates in Excel, I often see a number such as 37625 rather than a date such as
1/4/2003. What does this number mean, and how can I change it to a normal date?
Dates
37622
37623
37624
37625
37626
37627
37628
37629
37630
37631

Can I use a formula to display todays date automatically?

Perform the Following


1. Convert the dates into values
2. Extract Year, Month, and Days from the Dates
3. GetDay of the Week
4. Putting the date together
Dates

Values

Year

Month

4/Jan/2003
February 1, 1901
04/Jan/03
1/4/03
04/01/2003
03/01/01
4

How can I determine a date that is 50 workdays after another date? How can I exclude holidays, if I want to
50 workdays from start date
Start date
Later date

1/3/2003
8/4/2003

How can I determine the number of workdays between two dates?


Workdays between
(excluding
holidays)

150

Workdays between
(no holidays)

152

time formats.
Time Practice
8:30 AM =TIME(8,30,0)

excluding
holidays

8:30 PM =time(20,30,0)
3:10:30 PM =TIME(15,10,30)
1:10:30 AM =TIME(25,10,30)
0.3541666667 =TIMEVALUE("8:30")
Calculating Time Difference
Change the format to Number Format
7

Determine the time needed to complete jobs.


Start
Finish

5/12/2006 8:12
6/10/2006 12:30

5/12/2006 8:12
6/10/2006 7:30

I added up the total time an employee worked, and I never get more than 24 hours. What did I do wrong?
mon
tues
wed
thur
fri
total
38 hours 48 min
total reformatt

0:00:00 After Choosing the format 37:50:55 under time

Day

Day of the
Week

Putting date
together

de holidays, if I want to

Holidays
7/4/2003
1/20/2003

ours. What did I do wrong?

Anda mungkin juga menyukai