user14039142
user14039142

Reputation: 13

Counting the weekday number in excel

Is it possible to count the weekday number in excel?

Let's say

A B
Aug 1
Aug 2 1
Aug 3 2
Aug 20 15
Aug 30 22
Sep 1 1
Sep 2 2
Sep 3 3
Sep 4
Sep 5
Sep 6 4

Aug 1 is a Sunday so it is blank, Aug 2 is a Monday and it's the first weekday of the month so it counts as number 1, Aug 3 as number 2, Aug 20 as number 15 all the way to Aug 31 which is number 22. Then it starts counting again the following month.

Can this be done without VBA?

Upvotes: 1

Views: 82

Answers (1)

Scott Craner
Scott Craner

Reputation: 152450

Use NETWORKDAYS to return the workdays and wrap in IF to get blank the weekends:

=IF(WORKDAY(A1-1,1)=A1,NETWORKDAYS(EOMONTH(A1,-1)+1,A1),"")

enter image description here

You can also provide a range in the option third criterion of NETWORKDAYS and WORKDAY to include a list of holidays to not count.

Upvotes: 4

Related Questions