Sum days without (Saturday) Sunday

Maurizio

Well-known Member
Joined
Oct 15, 2002
Messages
687
Office Version
  1. 2007
Platform
  1. Windows
Hi all,
how can I sum to date a days' number without Sunday and Saturday and without only Sunday like:
Sunday and Saturday.xls
ABCDE
5where:A:withoutSundayandSaturday
6B:withoutSunday
7
8DateIniN_DaysDateA
910/08/031025/08/03why:16/17/23/24areSaturdayorSundayand15isfestive(Europe)
10DateB
1122/08/03why:17isSundayand15isfestive(Europe)
Foglio1


Tia.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi maurizio.rota,

I hate to cut and paste, but I think Workday() will help you:

From Help:
WORKDAY
See Also

Returns a number that represents a date that is the indicated number of working days before or after a date (the starting date). Working days exclude weekends and any dates identified as holidays. Use WORKDAY to exclude weekends or holidays when you calculate invoice due dates, expected delivery times, or the number of days of work performed. To view the number as a date, click Cells on the Format menu, click Date in the Category box, and then click a date format in the Type box.

If this function is not available, run the Setup program to install the Analysis ToolPak. After you install the Analysis ToolPak, you must enable it by using the Add-Ins command on the Tools menu.

How?

Syntax

WORKDAY(start_date,days,holidays)

Start_date is a date that represents the start date. Dates may be entered as text strings within quotation marks (for example, "1/30/1998" or "1998/01/30"), as serial numbers (for example, 35825, which represents January 30, 1998, if you're using the 1900 date system), or as results of other formulas or functions (for example, DATEVALUE("1/30/1998"))

Days is the number of nonweekend and nonholiday days before or after start_date. A positive value for days yields a future date; a negative value yields a past date.

Holidays is an optional list of one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays. The list can be either a range of cells that contain the dates or an array constant of the serial numbers that represent the dates. Learn about array constants. For more information about how Microsoft Excel uses serial numbers for dates, see the Remarks section.

Remarks

Excel stores dates as sequential serial numbers so that it can perform calculations on them. Excel stores January 1, 1900, as serial number 1 if your workbook uses the 1900 date system. If your workbook uses the 1904 date system, Excel stores January 1, 1904, as serial number 0 (January 2, 1904, is serial number 1). For example, in the 1900 date system, Excel stores January 1, 1998, as serial number 35796 because it is 35,795 days after January 1, 1900. Learn more about how Microsoft Excel stores dates and times.


If start_date is not a valid date, WORKDAY returns the #NUM! error value.


If start_date plus days yields an invalid date, WORKDAY returns the #NUM! error value.


If days is not an integer, it is truncated.

Examples

WORKDAY(DATEVALUE("01/03/1998"),5) equals 35804 or January 9, 1998.

If January 7, 1998, and January 8, 1998, are holidays, then:
WORKDAY(DATEVALUE("01/03/1998"),5,{35802,35803}) equals 35808 or January 13, 1998.

You can nest this in Text(string,format) with format something like "DD/MM/YY" for the format you wanted.
Hope this helps,
 
Upvote 0
Book13
ABCDE
1where:A:withoutSundayandSaturdayHolidays1
2B:withoutSunday15-Aug-03
3
4DateIniN_DaysDateAHolidays2
510-Aug-031025-Aug-0315-Aug-03
6DateB
71022-Aug-03
Sheet1


The range under Holidays1 is named, it figures, as Holidays1. This range should record all relevant holidays as is, because the formula in B5 is not affected by the fact that some holidays might fall on Saturdays and Sundays.

B5:

=NETWORKDAYS($A$5,$C$5,Holidays1)

Sometimes 1 day is added to such a formula! That is:

=NETWORKDAYS($A$5,$C$5,Holidays1)

Requirement: The range under Holidays2 is named as Holidays2. This range should record all relevant holidays with the exception of the holiday days that fall on a Sunday.

B7:

=SUMPRODUCT((WEEKDAY(ROW(INDIRECT($A$5&":"&$C$7)))<>1)-(ISNUMBER(MATCH(ROW(INDIRECT($A$5&":"&$C$7)),Holidays2,0))))

If the requirement for excluding only Sundays cannot be met or experienced as undesirable, one can use instead...

=SUMPRODUCT((WEEKDAY(ROW(INDIRECT($A$5&":"&$C$7)))<>1)-(ISNUMBER(MATCH(ROW(INDIRECT($A$5&":"&$C$7)),Holidays1,0))))+SUMPRODUCT(--(TEXT(Holidays1,"ddd")="Sun"))

where Holidays1 records all holiday dates on whichever day they fall.
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,600
Members
449,038
Latest member
Arbind kumar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top