How do I find number of months between dates in every quarter?

Copper Contributor

I have Start Date and End Date columns. I need to count how many months fall within Quarter4 2021 and Quarter1 2022, so I can count profit per quartal. Revenue is based on a month service.

ClientAccountStart dateEnd datePeriodsSumCurrencyQ4 2021Q1 2022
Acer56201.12.202131.12.2021126 000,00USD  
Accor56501.01.202231.07.202273 150,00USD  
Adidas57401.01.202131.12.20211211 167,20USD  
Activision Blizzard57701.01.202231.12.202436108 000,00USD  
Aflac70701.02.202131.01.2022123 500,00USD  
Adobe71001.02.202231.01.2023123 500,00USD  
Agilent Technologies92401.11.202131.01.202231 050,00USD  
Air France-KLM119001.12.202131.12.2021173 500,00USD  
Alibaba Group126512.07.202111.11.20244037 800,00USD  
1 Reply

@JohnB1254 

In H2:

=IFERROR(DATEDIF(MAX(C2,DATE(2021,10,1)),MIN(D2,DATE(2021,12,31)),"m")+1,0)

In I2

=IFERROR(DATEDIF(MAX(C2,DATE(2022,1,1)),MIN(D2,DATE(2022,3,31)),"m")+1,0)

Fill down.