Need a formula for months of a year from a given date range

%3CLINGO-SUB%20id%3D%22lingo-sub-2388722%22%20slang%3D%22en-US%22%3ENeed%20a%20formula%20for%20months%20of%20a%20year%20from%20a%20given%20date%20range%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2388722%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20the%20following%20in%20my%20spreadsheet%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHours%2FMonth(a)%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Start%20Date(b)%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BEnd%20Date(c)%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%202020%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B2019%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B2018%26nbsp%3B%20%26nbsp%3B%202017%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%202016%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%2040%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B9%2F1%2F2017%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B9%2F1%2F2019%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20need%20a%20formula%20that%20will%20take%20the%20year%2C%20look%20at%20the%20two%20dates%2C%20and%20then%20multiple%20the%20number%20of%20months%20in%20the%20year%20presented%20times%20the%20hours%2Fmonth.%20Is%20this%20possible%3F%20I%20am%20trying%20to%20calculate%20the%20hours%20a%20person%20may%20have%20worked%20in%20a%20year%20from%20the%20date%20range%20provided.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2388722%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2388987%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20a%20formula%20for%20months%20of%20a%20year%20from%20a%20given%20date%20range%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2388987%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F976451%22%20target%3D%22_blank%22%3E%40LadyMorbid7%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20D2%3A%3C%2FP%3E%0A%3CP%3E%3D%24A2*IFERROR(DATEDIF(MAX(DATE(D%241%2C1%2C1)%2C%24B2)%2CMIN(DATE(D%241%2B1%2C1%2C1)%2C%24C2)%2C%22m%22)%2C0)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22S0451.png%22%20style%3D%22width%3A%20812px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F283991i66012BAF59DF09C4%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22S0451.png%22%20alt%3D%22S0451.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I have the following in my spreadsheet:

 

Hours/Month(a)        Start Date(b)       End Date(c)      2020     2019     2018    2017      2016
        40                         9/1/2017             9/1/2019

 

I need need a formula that will take the year, look at the two dates, and then multiple the number of months in the year presented times the hours/month. Is this possible? I am trying to calculate the hours a person may have worked in a year from the date range provided.

 

1 Reply

@LadyMorbid7 

In D2:

=$A2*IFERROR(DATEDIF(MAX(DATE(D$1,1,1),$B2),MIN(DATE(D$1+1,1,1),$C2),"m"),0)

Fill to the right (and if applicable, down)

 

S0451.png