Count of Active Contracts between two dates

DDT123

New Member
Joined
Aug 9, 2011
Messages
36
Office Version
  1. 365
Platform
  1. Windows
Greetings! I have a spreadsheet which lists contract Effective Dates in column A, and contract Expiration Dates in column B. Column E lists dates (E1=1/1/2019, E2= 2/1/2019, and so on...)
I'm needing to create a chart so I can see a visual of how many ACTIVE contracts per month that we'll have over the next several years. Can anyone assist with the formula I'd put into F1?

Thank'ya in advance!!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I'm not quite sure what you want.
Below table gives an example how to calculate the number of active contracts between two dates.
Does this help you?

MrExcel.xlsx
AB
1eff dateexp date
201/01/201912/31/2021
301/02/201907/01/2021
403/15/202203/14/2025
5
6count act.1
7from date:01/01/2019
8to date:12/31/2021
Sheet3
Cell Formulas
RangeFormula
B6B6= SUMPRODUCT(--(($A2>=$B$7) * ($A2<=$B$8) * ($B2>=$B$7) * ($B2<=$B$8)))
Cells with Data Validation
CellAllowCriteria
B7:B8Datebetween 01/01/1970 and 12/31/2099
 
Upvote 0
Sorry, I've had the function wrong.

Use this formula to determine contracts that are/were only active between the given dates:
Excel Formula:
= SUMPRODUCT(--((A2:A4>=$B$7) * (A2:A4<=$B$8) * (B2:B4>=$B$7) * (B2:B4<=$B$8)))

Use this formula, if you need all currently active contracts:
Excel Formula:
= SUMPRODUCT(--((A2:A4>=$B$7) * (A2:A4<=$B$8) * (B2:B4>=$B$7)))
 
Upvote 0
Thank you for the response. I'm looking for a count of active contracts that fall between two dates (Columns A and B).
Column E lists the dates for the axis of my chart and Column F lists the counts of the active contracts. See example below...
Since my axis goes to year 2030, I'm needing contracts which expire on January 1, 2024 to not be counted as active contracts for February 2024 through 2030.



Active Contracts.JPG
 
Upvote 0
Alright, this should do it,

for Jan 2019 till Dec 2023 use this formula in column F, cell F2:
Excel Formula:
= SUMPRODUCT(--( ($A$2:$A$1048576<=E2) * ($B$2:$B$1048576>=E2) ))
and change the ranges $A$2:$A$1048576 and $B$2:$B$1048576 to match your data.
Then copy down the formula until Dec 2023.

For Jan 2024 to Dec 2030 use this formula in column F, cell F61:
Excel Formula:
= SUMPRODUCT(--( ($A$2:$A$1048576<=E62) * ($B$2:$B$1048576>=$E$61) ))
again, change the ranges to match your data and copy down the formula until Dec 2030

2021-12-11 18_47_00-MrExcel.xlsx - Excel.png


2021-12-11 18_48_02-MrExcel.xlsx - Excel.png
 
Upvote 0
That worked! Thank you!! But why the difference between the two formulas? For Jan 2024 to Dec 2030...
 
Upvote 0
But why the difference between the two formulas? For Jan 2024 to Dec 2030...
That's because of your requirements:
... I'm needing contracts which expire on January 1, 2024 to not be counted as active contracts for February 2024 through 2030.
If I got you right, every contract beyond January 2024 should not be taken into account, hence the two different formulas.
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,698
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top