=IF( A2>0, SUM( IFERROR( FILTER( Sheet1!C1:C10, A2 = IF( DAY( Sheet1!B1:B10 ) < 17, DATE( YEAR( Sheet1!B1:B10 ), MONTH( Sheet1!B1:B10 ), 1 ), IF( MONTH( Sheet1!B1:B10 ) = 12, DATE( YEAR( Sheet1!B1:B10 ) + 1, 1, 1 ), DATE ( YEAR( Sheet1!B1:B10 ), MONTH( Sheet1!B1:B10 ) + 1, 1 ) ) ) ) ) ) + SUM( IFERROR( FILTER( Sheet2!C1:C3, A2 = IF( DAY( Sheet2!B1:B3 ) < 17, DATE( YEAR( Sheet2!B1:B3 ), MONTH( Sheet2!B1:B3 ), 1 ), IF( MONTH( Sheet2!B1:B3 ) = 12, DATE( YEAR( Sheet2!B1:B3 ) + 1, 1, 1 ), DATE ( YEAR( Sheet2!B1:B3 ), MONTH( Sheet2!B1:B3 ) + 1, 1 ) ) ) ) ) ) + SUM( IFERROR( FILTER( Sheet3!C1:C2, A2 = IF( DAY( Sheet3!B1:B2 ) < 17, DATE( YEAR( Sheet3!B1:B2 ), MONTH( Sheet3!B1:B2 ), 1 ), IF( MONTH( Sheet3!B1:B2 ) = 12, DATE( YEAR( Sheet3!B1:B2 ) + 1, 1, 1 ), DATE ( YEAR( Sheet3!B1:B2 ), MONTH( Sheet3!B1:B2 ) + 1, 1 ) ) ) ) ) ) + SUM( IFERROR( FILTER( Sheet4!C1:C10, A2 = IF( DAY( Sheet4!B1:B10 ) < 17, DATE( YEAR( Sheet4!B1:B10 ), MONTH( Sheet4!B1:B10 ), 1 ), IF( MONTH( Sheet4!B1:B10 ) = 12, DATE( YEAR( Sheet4!B1:B10 ) + 1, 1, 1 ), DATE ( YEAR( Sheet4!B1:B10 ), MONTH( Sheet4!B1:B10 ) + 1, 1 ) ) ) ) ) ) + SUM( IFERROR( FILTER( Sheet5!C1:C8, A2 = IF( DAY( Sheet5!B1:B8 ) < 17, DATE( YEAR( Sheet5!B1:B8 ), MONTH( Sheet5!B1:B8 ), 1 ), IF( MONTH( Sheet5!B1:B8 ) = 12, DATE( YEAR( Sheet5!B1:B8 ) + 1, 1, 1 ), DATE ( YEAR( Sheet5!B1:B8 ), MONTH( Sheet5!B1:B8 ) + 1, 1 ) ) ) ) ) ) + SUM( IFERROR( FILTER( Sheet6!C1:C9, A2 = IF( DAY( Sheet6!B1:B9 ) < 17, DATE( YEAR( Sheet6!B1:B9 ), MONTH( Sheet6!B1:B9 ), 1 ), IF( MONTH( Sheet6!B1:B9 ) = 12, DATE( YEAR( Sheet6!B1:B9 ) + 1, 1, 1 ), DATE ( YEAR( Sheet6!B1:B9 ), MONTH( Sheet6!B1:B9 ) + 1, 1 ) ) ) ) ) ), )

Click to expand...