MATCH and INDEX to find most recent date
I am trying to find a solution to interpreting a complex military policy involving dates and relevant # of months. I am using 2016 but most everyone in my community uses Excel 2010 or 2007. I am trying to use MIN or MAX in conjunction with INDEX MATCH function, and I'm getting really stuck because I have other formulas and I'm not sure how to nest them.
ISSUE:
For each row, I need to find the number of months between the FIRST MONTH of the current (qualifying) activation, and the LAST MONTH of the previous (qualifying) activation.
Example: I want to find the number of months between activation #7 and #4
Currently, my formula finds this number by reading up one row, and based on the condition the months are calculated:
In Column H
=IF(G7="no","0",(YEAR(B8)-YEAR(C7))*12+MONTH(B8)-MONTH(C7))
B-Start C-End G-qual? H-#months
1 7/11/2005 9/23/2006 no 0
2 7/11/2007 9/23/2008 yes 0
3 7/11/2009 9/23/2010 yes 10
4 5/1/2011 2/20/2012 yes 8
5 10/1/2014 11/26/2014 no 32
6 12/1/2014 9/30/2015 no 0
7 1/10/2016 12/1/2016 yes 0
SOLUTION NEEDED:
If G7="yes", find number of months between date in B7 (START) and date in column C:C (END) that matches the row with the most recent occurence with "yes"
I have highlighted the cell in the Calcs2_Hide sheet to help decipher my notes.
Hope this made sense. Thank you in advance for any help.
Bookmarks