Any help with this is greatly appreciated. I know DATEDIF can be used to count the number of months in a date range, but what I need to do is get the number of months for a year within the range.

using the following parameters below, how is that possible?

A1 - start date
B1 - end date
C1 - year

let's say I make A1 = 6/1/2019
B1 = 6/30/2021
C1 = 2020

now, we know the calculated value returned should be 12, as all of 2020 is included in that range, but how would you get a formula to acknowledge the year from C1?