Вы находитесь на странице: 1из 7

Using Date and Time Unit III

Using Date and Time


Using Dates
 To enter the current date in a cell, the NOW and TODAY functions are used.
 Excel supports several functions to enter the current or the specified date in a cell.
 It also supports several date formats.
 For example: 12-Jan-19, 12/Jan/19, 12-Jan, Jan – 19 and so on.
 You can also perform arithmetic operations on two dates.

Entering the Current Date


The functions to enter the current date are TODAY and NOW.
 Each function does a specific job or calculation.
 Like a formula, a function also begins with ‘=’.
 After type the function name, you must type a pair of parentheses i.e.( ).

TODAY function
1. Press Ctrl+N to create a new workbook.
2. Enter =TODAY( ) in cell A1.
 Excel displays the current date in the format of dd/mm/yy in cell A1.
NOW function
By defauly, NOW function displays both date and time.
1. Press Ctrl+N to create a new workbook.
2. Enter =NOW( ) in cell A2.
 Excel displays the current date and time in the format of 12/Jan/19 12:05 in cell A2.
 The NOW function inserts a number corresponding to your computer’s system clock.
This number has two parts:
1. The integer part that contains the current date serial number.
2. The decimal part that contains the time information.
To Format the Date:
1. Make Cell A2 active.
2. Press Ctrl+1 or Use the FormatCells command from the menu.
 Excel displays the Format Cells dialog box.
3. Click ‘Date’ in the Category list box to the see the list of date formats.
1|Page
Using Date and Time Unit III

 In the Format Cells dialog box, Excel displaying the various date formats.

4. Click the corresponding format code in ‘Type’ box to change the date style for the
selected cell.
5. Then Click the OK button (or) Press Enter.
 Excel displays the date in specified format as 12-Jan-19 in cell A2.

Freezing the Date in a Cell


 A cell containing =NOW ( ) always displays the current date.
 If you open this workbook file tomorrow, the cell will display tomorrow’s date.
 If you do not want to change the current date, Excel allows you to freeze the current date.
To freeze the date:
 F9 function key is used to freeze the current date.
1. Activate the cell where you want to enter the date.
2. Type = TODAY( ) in the cell. (Do not press Enter)
3. Press the F9(Calc) function key and then Press the Enter Key.
 Excel displays a date number instead of the date in that cell.
 To format the cell, Press Ctrl+1 or Go to FormatCells command, then change the date
format in Format Cells dialog box.

2|Page
Using Date and Time Unit III

Entering Dates in a Worksheet


 Excel allows you to directly type the date in a cell.
 Excel is very flexible in accepting a date in the cell. It ignores capitalization.
 If you want to enter 12/Jan/19 in a cell, you can just type 12/Jan/19.
 You can enter the name of the month in upper, lower or mixed-case.
(e.g. 12-Jan-19, 12-jan-19, 12-JAN-19)
 You can enter it in any date formats.
 You can enter the dates in short form.
(e.g. dd-mmm 12-Jan, mmm-yy Jan-19)
 Excel automatically prefixes ‘19’ or ‘20’ to the year.
(e.g. 12/Jan/19 is stored in excel as 12/Jan/2019)
Therefore, you can safely enter the two-digit year and excel will interpret it correctly.
Example:
1. Press Ctrl+N or Click New button to create a new workbook.
2. Enter the text entries according to the following figure.

3. Format the text entered in cell where you want to display it in bold letters.

Using Date Arithmetic


To calculate the number of days, you need to subtract the check-in date from the check-out date.
 Type =C8-B8 in cell D8 and Type =C9-B9 in cell D9.
 Excel displays 5 in cell D8 and 4 in Cell D9.
To calculate the total charge, you need to multiply the Total Days and Charge per day.

3|Page
Using Date and Time Unit III

 Type =D8*B4 in cell E8 and Type =D9*B4 in cell E9.


 Excel displays 2500 in cell E8 and 2000 in Cell E9.

=C8-B8

=D8*B4

=D9*B4

=C9-B9
Advantage of Using Dates
1. You can reformat the date to display it in a new format.
2. You can use several date formats.
3. You can also create your own built-In date formats.
4. You can extract the Year, Month, Day from the date and use them in calculations.
5. You can subtract one date from another to calculate the number of days between the two
dates.
6. You can compare dates and take some decision based on the result.

Making a Cell Reference Absolute


 Excel uses relative cell addressing while copying a formula,.
 It supports two other addressing modes – Absolute and Mixed.
 To convert a relative cell reference to absolute or mixed, you can use F4 function
key.
Absolute Addressing
 Let us use the absolute addressing the in the formula used in E7.
1. Move the cell pointer to cell E7.
2. Type =B3 and Press the F4 function key.
 Excel changes B3 to $B$3 in cell E7 as well as the formula bar.

4|Page
Using Date and Time Unit III

 The ‘$’ sign before the row and column number indicates that the cell address B3 is
absolute.
 This cell address does not change when you copy or move a formula containing it.
Mixed Addressing
 Mixed cell addressing is a slight variation of the absolute cell addressing.
 In this, One part of the cell reference is absolute and the other is relative.
For example,
1. Type = B4 in cell B4. (Do not press Enter)
2. Press F4 function key, Now the cell address is changed to $B$4.
$B$4 – Both Column B and Row 4 are absolute.
3. Press F4 function key again, Now the cell address is changed to B$4.
B$4 - Column B is relative and Row 4 is absolute.
4. Press F4 function key again, Now the cell address is changed to $B4.
$B4- Column B is absolute and Row 4 is relative.
5. Press F4 function key again, Now the cell address is changed to B4.
B4-Both Column B and Row 4 are relative.
Additional Date Funtions
 You can extract the Year, Month, Day from the date.
For example:
1. Press Ctrl+N to open a new workbook.
2. Enter =DATE(19,01,12) in cell A1.
 Excel displays 12/01/19 in cell A1.
To change the date format, Press Ctrl+1 or Go to Format Cells command to format the date.
For manipulation of the date, Excel provides the following functions.
 DAY – Calculates the day of the month from the date.
 MONTH – Calculates the month number from the date.
 YEAR - Calculates the year number from the date.

5|Page
Using Date and Time Unit III

Date in Cell A1

=DAY(A1)

=MONTH(A1)

=YEAR(A1)

Using Time in a Worksheet


1. Press Ctrl+N to open a new workbook.
2. Type =NOW ( ) in cell A1 and Press the Enter key.
 Excel displays the current time in the cell in h:mm:ss format.

For example: It will show 7:20 AM as 7:20:00 and 3:20 PM as 15:20:00.


Entering Time
 You can enter the desired time in the worksheet by entering it in any of the acceptable
time formats.
 You can also extract the Hours, Minutes, Seconds from the time.
For example:
1. Press Ctrl+N to open a new workbook.
2. Enter =Now( ) in cell A1.
 Excel displays 30-09-2019 15:16 in cell A1.

To change the date format, Press Ctrl+1 or Go to Format Cells command to format the date.
For manipulation of the date, Excel provides the following functions.
 HOUR – Calculates the hour from the time.
 MINUTE – Calculates the minute from the time.
 SECOND - Calculates the second from the date.

6|Page
Using Date and Time Unit III

Time in Cell A1

=HOUR(A
1)
=MINUTE(A1)

=SECOND(A1)

7|Page

Вам также может понравиться