Rolling Calendar COUNTIFS question

Copper Contributor

I have a table that lists dates across the top row and a column listing items on the side. Image below.

spreadsheetsample.png

 

This is meant to be a rolling calendar, with new dates being added all the time. I'm trying to come up with a formula that counts all the "a"s over the last two weeks by item (not counting the "a"s from weeks before that). If an item appears twice in the first column (eg. "lime" in the image above), the formula should add up all the "a"s in both rows where that item appears.

 

I've tried various combinations of COUNTIFS with ISOWEEKNUM but no luck so far.

 

Is something like this possible?

 

Appreciate any help!

 

Josh

1 Reply
Given that Sheet1!A1 is blank, you may try this formula:
=SUMPRODUCT(--(INDEX(ItemData,1,
MATCH(INDEX(DateLabels,COUNT(DateLabels))-13,DateLabels,1)):
INDEX(ItemData,COUNTA(ItemLabels),COUNT(DateLabels))="a"))
The defined names are:
DateLabels=Sheet1!$B$1:INDEX(Sheet1!$1:$1,COUNT(Sheet1!$1:$1)+1)
ItemData=Sheet1!$B$2:INDEX(Sheet1!$B:$XFD,COUNTA(Sheet1!$A:$A)+1,COUNT(Sheet1!$1:$1)+1)
ItemLabels=Sheet1!$A$2:INDEX(Sheet1!$A:$A,COUNTA(Sheet1!$A:$A)+1)