I have sheets with this data (simplified for the example):
range A1:A10 = dates
range B1:B10 = items to count
range C1:C10 = items to sum
and I have two reference cells:
D1 = week number
D2 = year
I have used
one formula to count:
1) to count the whole column B range if no week number is specified in D1 (D1 is blank)
2) and to count the column B data for a specified week number if a week number is present in D1
=IF(ISBLANK(D1);COUNTA(B1:B10);SUMPRODUCT(--(WEEKNUM(A1:A10+0;2)=D1)+0;--(B1:B10<>"")))
and another formula to sum:
1) to sum the whole column C range if no week number is specified in D1 (D1 is blank)
2) and to sum the column C data for a specified week number if a week number is present in D1
=IF(ISBLANK(D1);SUM(C1:C10);SUMPRODUCT(--(WEEKNUM(A1:A10+0;2)=D1)+0;C1:C10))
Now my data has accumulated over one year, and I need to modify my two formulas so that they would:
1) count and sum according to week number and year, if specified in D1 and D2
2) count and sum according to year only, if specified in D2 (and D1 is blank)
3) count and sum the whole range, if no week number and year are specified (D1 and D2 are blank)
and still not using helper columns
Thanks in advance for all replies!
range A1:A10 = dates
range B1:B10 = items to count
range C1:C10 = items to sum
and I have two reference cells:
D1 = week number
D2 = year
I have used
one formula to count:
1) to count the whole column B range if no week number is specified in D1 (D1 is blank)
2) and to count the column B data for a specified week number if a week number is present in D1
=IF(ISBLANK(D1);COUNTA(B1:B10);SUMPRODUCT(--(WEEKNUM(A1:A10+0;2)=D1)+0;--(B1:B10<>"")))
and another formula to sum:
1) to sum the whole column C range if no week number is specified in D1 (D1 is blank)
2) and to sum the column C data for a specified week number if a week number is present in D1
=IF(ISBLANK(D1);SUM(C1:C10);SUMPRODUCT(--(WEEKNUM(A1:A10+0;2)=D1)+0;C1:C10))
Now my data has accumulated over one year, and I need to modify my two formulas so that they would:
1) count and sum according to week number and year, if specified in D1 and D2
2) count and sum according to year only, if specified in D2 (and D1 is blank)
3) count and sum the whole range, if no week number and year are specified (D1 and D2 are blank)
and still not using helper columns
Thanks in advance for all replies!