Another solution, this time one that doesn't use an array formula. It requires your dates are sorted oldest to newest.
Again, in my formula the columns contain data starting in row 2:
A: codes
B: dates
C: current period % value
D: prior period % value (desired result)
=IFERROR(INDEX($C1:C$2,MATCH(A2,INDEX($A1:A$2,IFERROR(MATCH(DATE(YEAR(B2),MONTH(B2)-1,0),$B1:B$2,0),1)):INDEX($A1:A$2,MATCH(DATE(YEAR(B2),MONTH(B2),1),$B1:B$2,1)),0)),"")
*This one does not have to be entered with CTRL + SHIFT + ENTER
example1.jpg
Bookmarks