Calculating Daily Census

ExcelNerd24

New Member
Joined
Dec 6, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,

What formula could I use to calculate the daily census based on the admission and discharge dates noted below?

1733510590226.png
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
I cannot use an image to create an example with your data.
Try the following

T202412a.xlsm
CFGHIJK
1NameAdmissionDischargeDaily Census
2
3A1-Nov-2421-Nov-241
4B5-Nov-2420-Nov-242-Nov-241
5C20-Nov-241-Dec-243-Nov-241
6D1-Dec-244-Nov-241
75-Nov-242
86-Nov-242
97-Nov-242
108-Nov-242
119-Nov-242
1210-Nov-242
1311-Nov-242
1412-Nov-242
15
1d
Cell Formulas
RangeFormula
I3I3=COUNTIFS(F:F,">0")-COUNTIFS(G:G,">0")
K3:K14K3=SUM((F:F<=J3)*(F:F>0),-(G:G<=J3)*(G:G>0))
 
Upvote 0
@ExcelNerd24
Welcome to the MrExcel board!

I note that you have "Liked" post 2. If you are going to use that formula structure then I would highly recommend changing from whole column references to something much smaller but still big enough to cover any data you might have. In the mini sheet* below I have used that formula in column K and an alternative in column L. On my machine just those 20 formulas in column K take over 3 seconds to recalculate whereas the 20 formulas in column L take about 0.005 seconds to recalculate. I'm not suggesting that is because of the different formula (that is just an option) but mainly because of the restricting the rows to 1000 instead of over 1 million.

* I suggest that you investigate XL2BB for providing sample data to make it easier for helpers by not having to manually type out sample data to test with.
(If you have trouble with XL2BB, review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of the XL2BB Instructions page linked above.)

24 12 07.xlsm
FGIJKL
1
2AdmissionDischarge
3
41/11/20241/11/202411
55/11/202420/11/20242/11/202411
620/11/20241/12/20243/11/202411
71/12/20244/11/202411
85/11/202422
96/11/202422
107/11/202422
118/11/202422
129/11/202422
1310/11/202422
1411/11/202422
1512/11/202422
1613/11/202422
1714/11/202422
1815/11/202422
1916/11/202422
2017/11/202422
2118/11/202422
2219/11/202422
2320/11/202422
Census
Cell Formulas
RangeFormula
K4:K23K4=SUM((F:F<=J4)*(F:F>0),-(G:G<=J4)*(G:G>0))
L4:L23L4=LET(d,IF(F$4:G$1000="",9^9,F$4:G$1000),SUM((TAKE(d,,1)<=J4)*(TAKE(d,,-1)>J4)))
 
Upvote 0

Forum statistics

Threads
1,224,876
Messages
6,181,519
Members
453,050
Latest member
Obil

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