Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - Dates From - to 2

Status
Not open for further replies.

Llwynog

Technical User
Feb 12, 2004
22
0
0
GB
I'm setting up a spreadsheet to track sickness absence, and have the usual 'FROM' 'TO' headings, with the dates formatted as date, and the third column heade 'NO. of DAYS ABSENT, formatted as number.
Works OK when a date is from, say, 3rd March to 5th March, but not when there is only a single day of absence (Excel duly comes up with the correct arithmetical answer of 0).
What am I doing wrong please.
Thanks, and regards
 



Hi,

[tt]
=To-From+1
[/tt]


Skip,
[sub]
[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue][/sub]
 
If you only want to count absences from Monday through Friday (and perhaps even take holidays into account), then Excel has a nifty function called NETWORKDAYS that can be used for this purpose:
=NETWORKDAYS(A2,B2,$Z$2:$Z$10)
A2 is the first day absent
B2 is the last day absent
Z2:Z10 are the dates of paid holidays

Note that NETWORKDAYS requires the Analysis ToolPak. This is an optional feature in Excel 2003 and earlier. To enable it:
1) Open the Tools...Add-Ins menu item
2) Check the box for Analysis ToolPak. Ignore the box for Analysis ToolPak - VBA
3) Click OK

Brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top