I have a Google Sheet of renewal opportunities and the date that each opportunity move into a new renewal stage, which can be found here. The end goal is to see how many opportunities were in each stage during any given "snapshot date".
I created an INDEX MATCH formula that looks at columns of stage change dates and will return the stage based on the snapshot date given. The problem is that I have to have an additional column for each snapshot date that I want to look at.
=IFERROR(INDEX(SUBSTITUTE($A$1:$G$1," (AUTOMATIC)",""),MATCH(I$1,ARRAYFORMULA(IF($A2:$G2="","",TO_DATE(INT($A2:$G2)))),1)),"Untouched")
Is there a way to evaluate the columns with the INDEX MATCH formula and then the resulting rows, all in one array formula? I want the output to look like the table in Columns O:T.


Here is my attempt:
and my sheet:
https://docs.google.com/spreadsheets/d/1SZcAsALTxu2fpNu3s-4fIq-ms5IDyXijQWF1c49mtkU/edit?usp=sharing
I realize I don't have "untouched" figured out yet because i don't see any values in the "untouched" column, so i'm not entirely clear on the logic of that one yet.
How do the other numbers look? I used FLOOR(...7 ) on the dates, so it'll count anything in the week associated with the monday, not just dates that fall ON that monday.