Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
228 views
in Technique[技术] by (71.8m points)

excel - Check day is the last working day of the month

I need to write the formula to check the last working day of the month in excel.

Data look like this:

| Date | | 2018/10/22 | | 2018/10/31 |

The output should be:

| Date | Check | | 2018/10/22 | o | | 2018/10/31 | x |

Working day: from Mon to Friday, No holidays.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The 'last working day of the month' is a bit ambiguous given different holiday structures and the fact that not everyone works Monday to Friday. However, if a list of local holidays is provided in Z2:Z13, the WORKDAY.INTL function should be able to return the last workday of any month with a variety of work and holiday schedules.

=WORKDAY.INTL(EOMONTH(A2, 0)+1, -1, "0000011", Z$2:Z$13)

For the purpose of demonstration, I've added the weekday to the date format with a custom number format of ddd, yyyy/mm/dd_).

In the following sample image, note that the fictional holiday of Wed, 2018/01/31 pushed the 'last workday of the month' to Tue, 2018/01/30 and March's last day is Fri, 2018/03/30 since Saturday is considered a non-workday.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...