Forum Discussion

JenniferSilbers's avatar
JenniferSilbers
Qrew Trainee
4 years ago

Total work days in a Month

Hello,

I am trying to calculate the total work days in a month based on today's date.  Here is my formula but it is not working correctly, I am getting a total of 25 days for February and there are only 20 working days in February for this year.  Dates and duration formulas in Quick Base are new for me so any help is appreciated. 

Formula:
ToDays(ToWeekdayP(LastDayOfMonth([Today's Date])) - (ToWeekdayN(FirstDayOfMonth([Today's Date]))))

My team wants to see what business day they are on (which I figured out) and then how many business days are in each month.  

Thanks

------------------------------
Jennifer Silberstein
------------------------------

2 Replies

  • There is a special function in QuickBase which knows how to count just the weekdays, just the Monday to Fridays.  This would be a formula numeric field type

    For clarity I will break this down in little pieces.

    var date FirstDay = FirstDayOfMonth(Today());
    var date LastDay = LastDayOfMonth(Today());

    WeekdaySub($LastDay, $FirstDay) + 1


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend
      I guess that you don't need the + 1 after all.
      WeekdaySub($LastDay, $FirstDay)

      ------------------------------
      Mark Shnier (YQC)
      Quick Base Solution Provider
      Your Quick Base Coach
      http://QuickBaseCoach.com
      mark.shnier@gmail.com
      ------------------------------