Using Advanced Date and Time Functions Dates and times are really just numbers—sometimes you might see them called “serial numbers”

Using Advanced Date and Time Functions Dates and times are really just numbers—sometimes you might see them called “serial numbers”

or “serialized dates.” Any date in Excel evaluates to the number of days since December 31st, 1899 (actually, Excel will try to tell you that zero is “January 0, 1900”). Any time in Excel is the corresponding fraction of a day—noon is midday, which is 0.5. The time 6:00 a.m. equals 0.25, and 6:00 p.m. equals 0.75. This allows us to easily calculate the number of days between dates, the number of hours between times, or to add up times.

The following exercise runs through several functions that work with date and time values, includ- ing the TODAY function, which returns the current date, and the NOW function, which returns the current date and time. Other functions extract parts of date values, such as year, month, or day; and extract parts of time values like hour, minute, or second.

In the exercise, we’ll also calculate the number of days between two dates and then use functions to calculate the number of working days between two dates (not counting weekends). Then, we’ll use an alternate function that allows us to count working days if we don’t have standard weekends. For example, our “weekends” are Tuesdays and Wednesdays instead of Saturdays and Sundays. Finally, we’ll calculate net working days that exclude holidays.

Other steps in the exercise will show how to project dates forwards or backwards if we have the starting or ending date and the number of days. We’ll do a simple projection; then we’ll project forwards and backwards 100 working days and then 100 working days with a list of holidays.

70 Lesson 3

STEP BY STEP

Use Advanced Date and Time Functions

GET READY . LAUNCH Excel 2016 if it is not already open.

1. OPEN the

03 Dates.xlsx workbook file for this exercise.

2. SAVE the workbook as

03 Dates Solution.xlsx .

3. Enter the following formulas into the specified cells:

B6 = TODAY( ) B7 = NOW( ) - TODAY( ) B8 = NOW( )

4. In cell C3 enter the formula:

= YEAR(B3)

Use AutoFill to fill the formula in C3 down through C8 . AutoFill will also copy cell

C3’s formatting into C4:C8. Click the AutoFill Options button and select Fill Without

Formatting .

5. Repeat step 4, entering the following formulas into the specified cells and filling down through row 8, filling the cells without formatting.

D3 = MONTH(B3) E3 = DAY(B3) F3 = HOUR(B3) G3 = MINUTE(B3) H3 = SECOND(B3) I3 = WEEKDAY(B3)

Your worksheet should resemble Figure 3-7, with the exception of the dates and times in rows 6-8, which will reflect your current date and time.

Figure 3-7 Entering advanced date and

time functions

6. Enter the following formula in N3 :

= M3-L3

7. Enter the following formula in O3 :

= NETWORKDAYS(L3,M3)

8. Enter the following formula in O4 : = NETWORKDAYS.INTL(L3,M3,4)

9. Enter the following formula in O5 :

= NETWORKDAYS(L3,M3,tbl.Holidays[Holidays])

10. Enter the following formula in M8 :

= L8+N8

11. Enter the following formula in L9 :

= M9-N9

12. Enter the following formula in M10 :

= WORKDAY(L10,O10)

13. Enter the following formula in L11 :

= WORKDAY(M11,-O11)

Using Advanced Functions and Analyzing Data

14. Enter the following formula in M12 :

= WORKDAY(L12,O12,tbl.Holidays[Holidays])

15. You may have noticed that Excel used serial numbers in cells M10, L11, and M12 instead of dates. Remember, the numbers don’t change when we convert a cell to a date, only the formatting changes. Format cells M10, L11, and M12 using the d-mmm-yy format (see Figure 3-8).

Figure 3-8 More advanced date and

time functions

16. SAVE the workbook and CLOSE it. PAUSE . LEAVE Excel open to use in the next exercise.

Using Nested Functions Whenever you place a function inside another function you are nesting them. You can nest almost

any function inside almost any other function. In the following exercise, we will nest a couple of functions to extract and transform first names from a list of first and last names, and change them to proper case.

STEP BY STEP

Use Nested Functions

GET READY . LAUNCH Excel 2016 if it is not already open.

1. OPEN the

03 Nested Functions.xlsx workbook file for this exercise.

2. SAVE the workbook as

03 Nested Functions Solution.xlsx .

3. Enter the following formula into cell C4 and then double-click the fill handle.

=FIND(“ “,B4)

4. Enter the following formula into cell D4 and then double-click the fill handle.

=LEN(B4)

5. Enter the following formula into cell E4 and then double-click the fill handle.

=D4-C4

6. Enter the following formula into cell F4 and then double-click the fill handle.

=RIGHT(B4,E4)

72 Lesson 3

7. Enter the following formula into cell G4 and then double-click the fill handle.

=PROPER(F4)

8. Enter the following formula into cell H4 and then double-click the fill handle.

=PROPER(RIGHT(B4,LEN(B4)-FIND(“ “,B4)))

This nested version of the formula incorporates the formulas entered in previous steps (see Figure 3-9). It uses four different functions, three of which (RIGHT, LEN, and FIND) are nested.

Figure 3-9 Using nested functions

9. SAVE the workbook and CLOSE it. PAUSE . LEAVE Excel open to use in the next exercise.

Dokumen yang terkait

Analisis Komparasi Internet Financial Local Government Reporting Pada Website Resmi Kabupaten dan Kota di Jawa Timur The Comparison Analysis of Internet Financial Local Government Reporting on Official Website of Regency and City in East Java

19 819 7

Analisis Komposisi Struktur Modal Pada PT Bank Syariah Mandiri (The Analysis of Capital Structure Composition at PT Bank Syariah Mandiri)

23 288 6

Improving the Eighth Year Students' Tense Achievement and Active Participation by Giving Positive Reinforcement at SMPN 1 Silo in the 2013/2014 Academic Year

7 202 3

An Analysis of illocutionary acts in Sherlock Holmes movie

27 148 96

Improping student's reading comprehension of descriptive text through textual teaching and learning (CTL)

8 140 133

Teaching speaking through the role play (an experiment study at the second grade of MTS al-Sa'adah Pd. Aren)

6 122 55

Enriching students vocabulary by using word cards ( a classroom action research at second grade of marketing program class XI.2 SMK Nusantara, Ciputat South Tangerang

12 142 101

The Effectiveness of Computer-Assisted Language Learning in Teaching Past Tense to the Tenth Grade Students of SMAN 5 Tangerang Selatan

4 116 138

Analysis On Students'Structure Competence In Complex Sentences : A Case Study at 2nd Year class of SMU TRIGUNA

8 98 53

The correlation between listening skill and pronunciation accuracy : a case study in the firt year of smk vocation higt school pupita bangsa ciputat school year 2005-2006

9 128 37