Solution: There is an easy way to convert the range of holidays to a named range. Follow these steps:
- Type your company holidays as a column of dates in E1:E10.
- In a blank cell, type =E1:E10. Do not press Enter. Instead, press the F9 key. Excel calculates the formula and returns an array of date serial numbers, as shown in Figure 6. Notice that everything after the equals sign is already selected.
- Press Ctrl+C to copy the array to the Clipboard.
- Press Esc to exit Formula Edit mode. The formula disappears.
- Visit the Name dialog box. (In Excel 97-2003, select Insert, Name, Define. In Excel 2007, select Formulas, Defi ne Name.)
- Type Holidaysas the name.
- In the Refers To box, clear the current text. Type an equals sign. Press Ctrl+V to paste the array of dates to the box. Click OK.
Figure 6. Press F9, and Excel converts the range reference to an array of serial numbers. |
Now you can use the named range Holidays as the third argument of the WORKDAY and NETWORKDAYS functions.
Gotcha: While these names work fine with WORKDAY and NETWORKDAYS, they fail in complex array formulas.
Summary: You can convert a range of dates to a named array to simplify the use of the WORKDAY and NETWORKDAYS functions.
megjegyzés0
Post a Comment