I'm working on an excel sheet, and trying to get the most recent occurrence of an event from multiple sheets. I currently have three sheets.
Sheet 1 is called "Recipes", and it lists 9 recipes, each with a unique recipe number:
I have two other sheets, "2017", and "2016", where I list several dates, which recipe was made on that date, and who made it:
Now what I want, is on the Recipes sheet, to list for each recipe how many times it has been made, the last time is was made, and by whom. Like so:
How many times it has been made was pretty easy with a count function. But the most recent made has been trickier. I found this article, which has a function to get the most recent instance of something, which was very helpful. So I used this formula:
=INDEX('2017'!$A$2:$A$10,SUMPRODUCT(MAX(ROW('2017'!$C$2:$C$10)*($A2='2017'!$C$2:$C$10))-1))
To get me when the recipe was made last in 2017, which works quite well:
But as you can see, when it comes to the blueberry muffins, it doesn't work, because that recipe wasn't made in 2017. I need to extend the formula to work on multiple years. I could potentially add more years in the past as well. I thought I could just concatenate multiple of those above functions into a giant MAX function, one for each year, like so:
=MAX(
INDEX('2017'!$A$2:$A$10,SUMPRODUCT(MAX(ROW('2017'!$C$2:$C$10)*($A2='2017'!$C$2:$C$10))-1)),
INDEX('2016'!$A$2:$A$10,SUMPRODUCT(MAX(ROW('2016'!$C$2:$C$10)*($A2='2016'!$C$2:$C$10))-1))
)
But that doesn't work. What's the easiest way to go about this?




