technology excel - strategic finance...the final formula is shown in figure 3. the formula for cell...

2
Let’s say that you want to calculate a delivery date in Excel. You have columns that indicate the shipping date, the number of days in transit, and the shipping service. You need to calcu- late the expected delivery date based on the work days of the shipping carrier. The roots of this solution start back in Excel 97 with the WORKDAY func- tion. If you specified a start date, a number of elapsed days, and a range containing holiday dates, the WORK- DAY function would return a valid Mon- day through Friday date, always ignoring holidays. The WORKDAY function was avail- able in Excel 2003 and earlier, but only if you had enabled the Analysis TookPak add-in. This made it a dangerous choice to use—if someone who didn’t have the Analysis ToolPak installed opened your worksheet, the WORKDAY func- tion would return a #NAME? error. Beginning with Excel 2007, WORKDAY became part of the core Excel function set. In Excel 2010, Microsoft expanded and enhanced the function, offering WORKDAY.INTL. The enhancement included an extra argument to specify the days—or day—that should be con- sidered the weekend. In this particular problem, each carri- er could offer a different set of week- end days. If you are shipping UPS, deliveries won’t happen on Saturday or Sunday. This would work fine with the old WORKDAY function. If you are ship- ping with the U.S. Postal Service (USPS), deliveries could happen on a Saturday. If you are shipping FedEx Home (FDXH), deliveries won’t happen on Sunday or Monday. In other words, without this enhancement, the shipping calculation could fail if you tried to use the WORK- DAY function for USPS or FedEx Home. Setting Up the Holiday Table In a blank section of your workbook, enter a list of holiday dates, as shown in Figure 1. Although Figure 1 includes the holiday name, this information isn’t nec- essary for the formula. To simplify the for- mula, give the range of holidays a name. In Figure 1, you would follow these steps: 1. Select A2:A11. 2. Click in the Name box to the left of the formula bar. 3. Type a name, such as HolidayList, and press Enter. Remember that names can’t include spaces. Understanding the Weekend Argument Previously, the old WORKDAY argument would always assume Saturday and Sun- day were the weekend days. Starting with Excel 2010, the WORKDAY.INTL function allows for 14 different sets of weekend dates. A value of 1 assumes the typical weekend of Saturday and Sunday. Values 2-7 assume various other two-day weekends. Values 11-17 assume various one-day weekends. Table 1 shows the 14 possible values for the weekend argument. 60 STRATEGIC FINANCE I March 2012 TECHNOLOGY EXCEL Calculating Delivery Dates in Excel By Bill Jelen Figure 1

Upload: others

Post on 28-Dec-2019

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: TECHNOLOGY EXCEL - Strategic Finance...The final formula is shown in Figure 3. The formula for cell E2 is =WORKDAY. INTL(B2,D2,VLOOKUP(C2,DaysOffTable,2, FALSE),HolidayList). This

Let’s say that you want to calculate a

delivery date in Excel. You have

columns that indicate the shipping

date, the number of days in transit, and

the shipping service. You need to calcu-

late the expected delivery date based

on the work days of the shipping

carrier.

The roots of this solution start back

in Excel 97 with the WORKDAY func-

tion. If you specified a start date, a

number of elapsed days, and a range

containing holiday dates, the WORK-

DAY function would return a valid Mon-

day through Friday date, always

ignoring holidays.

The WORKDAY function was avail-

able in Excel 2003 and earlier, but only

if you had enabled the Analysis TookPak

add-in. This made it a dangerous choice

to use—if someone who didn’t have

the Analysis ToolPak installed opened

your worksheet, the WORKDAY func-

tion would return a #NAME? error.

Beginning with Excel 2007, WORKDAY

became part of the core Excel function

set. In Excel 2010, Microsoft expanded

and enhanced the function, offering

WORKDAY.INTL. The enhancement

included an extra argument to specify

the days—or day—that should be con-

sidered the weekend.

In this particular problem, each carri-

er could offer a different set of week-

end days. If you are shipping UPS,

deliveries won’t happen on Saturday or

Sunday. This would work fine with the

old WORKDAY function. If you are ship-

ping with the U.S. Postal Service (USPS),

deliveries could happen on a Saturday.

If you are shipping FedEx Home (FDXH),

deliveries won’t happen on Sunday or

Monday. In other words, without this

enhancement, the shipping calculation

could fail if you tried to use the WORK-

DAY function for USPS or FedEx Home.

Setting Up the Holiday TableIn a blank section of your workbook,

enter a list of holiday dates, as shown in

Figure 1. Although Figure 1 includes the

holiday name, this information isn’t nec-

essary for the formula. To simplify the for-

mula, give the range of holidays a name.

In Figure 1, you would follow these steps:

1. Select A2:A11.

2. Click in the Name box to the left of

the formula bar.

3. Type a name, such as HolidayList, and

press Enter. Remember that names

can’t include spaces.

Understanding theWeekend ArgumentPreviously, the old WORKDAY argument

would always assume Saturday and Sun-

day were the weekend days. Starting

with Excel 2010, the WORKDAY.INTL

function allows for 14 different sets of

weekend dates. A value of 1 assumes

the typical weekend of Saturday and

Sunday. Values 2-7 assume various

other two-day weekends. Values 11-17

assume various one-day weekends.

Table 1 shows the 14 possible values for

the weekend argument.

60 S T R AT E G IC F I N A N C E I M a rc h 2 0 1 2

TECHNOLOGY

EXCELCalculating Delivery Dates in Excel

By Bill Jelen

Figure 1

Page 2: TECHNOLOGY EXCEL - Strategic Finance...The final formula is shown in Figure 3. The formula for cell E2 is =WORKDAY. INTL(B2,D2,VLOOKUP(C2,DaysOffTable,2, FALSE),HolidayList). This

Setting Up theWeekend TableIn this situation, the weekend argu-

ment varies by carrier. Figure 2 illus-

trates a named range called

DaysOffTable. It converts each shipper

code to one of the weekend schemes

for the WORKDAY.INTL function.

USPS has a value of 11, which corre-

sponds to Sunday-only as the week-

end. FDXH uses a value of 2, which

means a weekend of Sunday and

Monday.

Putting It AllTogetherThe final formula is shown

in Figure 3. The formula for

cell E2 is =WORKDAY.

INTL(B2,D2,VLOOKUP(C2,DaysOffTable,2,

FALSE),HolidayList). This formula starts

out simply enough, specifying the ship

date from cell B2 and the days in transit

from cell D2. To derive the Weekend

value, a VLOOKUP

function uses the

shipper code in cell

C2 to find the cor-

rect code from the

table in Figure 2.

The fourth argu-

ment points to the

range of holiday

dates from Figure 1.

Formattingthe AnswerOften, Excel is able

to figure out that you are looking for a

date as your answer and will automati-

cally format the cell to show a date. For

example, if you had entered =B2+D2 in

cell E2, Excel would have seen the for-

matting in cell B2 and automatically

changed the format of cell E2 to a Date

format as soon as you pressed Enter to

finish the formula. Because WORKDAY

wasn’t originally part of the core Excel

product, however,

both WORKDAY and

WORKDAY.INTL will never

automatically format the

result as a date. The result

will instead be a number, such as 41052.

This is the correct answer, but Excel is

using a General format instead of a Date

format. (May 23, 2012, is 41,052 days

after December 31, 1899.) Once you’ve

entered your WORKDAY.INTL formula,

format the cell as a Short Date using the

dropdown in the Home tab of the rib-

bon. The answer will change back to the

correct date. SF

Bill Jelen is the author of Learn Excel

2007-2010 From MrExcel and 33 other

books. Send questions for future articles

to [email protected].

M a rc h 2 0 1 2 I S T R AT E G IC F I N A N C E 61

Figure 2

Figure 3

Table 1. Values forWeekend Argument

Value Weekend Days

1 Saturday, Sunday

2 Sunday, Monday

3 Monday, Tuesday

4 Tuesday, Wednesday

5 Wednesday, Thursday

6 Thursday, Friday

7 Friday, Saturday

11 Sunday only

12 Monday only

13 Tuesday only

14 Wednesday only

15 Thursday only

16 Friday only

17 Saturday only