You will need a list of holidays. The WORKDAY function will calculate the date of the N-th workday before a start date when you specify N-1. For your example, if today were 9 January 2024, the formulas
- SUMIF(A9:A20,">="&WORKDAY(TODAY(),-2,holiday-dates),B9:B20)
- SUMIF(A9:A20,">="&WORKDAY(TODAY(),-6,holiday-dates),B9:B20)
would do what you want for workdays.
For total days, the criteria is simply ">="&TODAY()-2 or ">="&TODAY()-6