Count days in date range

Discuss the spreadsheet application
Post Reply
shagivan
Posts: 2
Joined: Sat Jan 26, 2019 8:17 pm

Count days in date range

Post by shagivan »

Hi all,
I'm trying to find number of Mondays and Saturdays in a date range. Could some assist with the formula pls.
For eg: between 01/01/19 and 31/01/19 how many Mondays and Saturdays. I found no of week days using NETWORKDAYS. but I need it for everyday.
Please advice
Thanks
Open office 2.3
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Count days in date range

Post by Villeroy »

Count_Weekdays.ods
(16.77 KiB) Downloaded 112 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
shagivan
Posts: 2
Joined: Sat Jan 26, 2019 8:17 pm

Re: Count days in date range

Post by shagivan »

That gives one day less in all day counts
Open office 2.3
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Count days in date range

Post by Villeroy »

Yes, that's right because the division counts the the time spans between the Xdays. Just append +1 to the last formula.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
lader
Posts: 47
Joined: Mon Jul 02, 2018 6:10 pm

Re: Count days in date range

Post by lader »

Code: Select all

= INT(($C$4-2)/7) - INT(($C$3-2)/7) + (MOD($C$4-2; 7)>=$C$5) + (MOD($C$3-2; 7)<=$C$5) - 1
C3 - Start date
C4 - End date
C5 - Select number from 0 to 6 for monday, tuesday, etc.
LibreOffice 7.6.6.3 on Ubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Count days in date range

Post by Villeroy »

lader wrote:

Code: Select all

= INT(($C$4-2)/7) - INT(($C$3-2)/7) + (MOD($C$4-2; 7)>=$C$5) + (MOD($C$3-2; 7)<=$C$5) - 1
C3 - Start date
C4 - End date
C5 - Select number from 0 to 6 for monday, tuesday, etc.
YEP!
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply