Count the adjacent cells date for people database on their check-in check-out dates

%3CLINGO-SUB%20id%3D%22lingo-sub-2716157%22%20slang%3D%22en-US%22%3ECount%20the%20adjacent%20cells%20date%20for%20people%20database%20on%20their%20check-in%20check-out%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2716157%22%20slang%3D%22en-US%22%3E%3CDIV%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22public-DraftStyleDefault-block%20public-DraftStyleDefault-ltr%22%3E%3CSPAN%3EI%20would%20like%20to%20know%20if%20there's%20a%20way%20to%20count%20if%20a%20range%20of%20dates%20is%20within%20the%20given%20date.%20In%20this%20example%2C%20the%20occupied%20rooms%20in%20a%20fixed%20single%20location%20based%20on%20their%20check-in%20and%20check-out%20dates%2C%20Person%20A%20check%20in%20on%2015%2F08%20and%20check%20out%20on%2019%2F08%2C%20I%20would%20like%20the%20formula%20to%20count%201%20on%20summary%20table%20on%2015%2F08%2C%2016%2F08%2C%2017%2F08%20and%20so%20on.%3CBR%20%2F%3E%3CBR%20%2F%3EThere's%20a%20lot%20of%20examples%20to%20check%20if%20a%20date%20is%20between%20a%20range%20of%20dates%20but%20can't%20find%20the%20other%20way%20around%20so%20far.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22public-DraftStyleDefault-block%20public-DraftStyleDefault-ltr%22%3E%3CSPAN%3EHere's%20the%20example%20on%20my%20questions%20along%20with%20the%20example%20file%20attached%3A%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3COL%3E%3CLI%3E%3CDIV%20class%3D%22public-DraftStyleDefault-block%20public-DraftStyleDefault-ltr%22%3E%3CSPAN%3ETable%201%20is%20the%20database%20of%20people%2C%20real%20case%20scenario%20I%20have%20around%203000%2B%20names%20to%20work%20with%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FLI%3E%3CLI%3E%3CDIV%20class%3D%22public-DraftStyleDefault-block%20public-DraftStyleDefault-ltr%22%3E%3CSPAN%3ETable%202%20is%20the%20summary%20count%20of%20each%20date%20I%20want%20it%20to%20be.%20Example%20below%20should%20clarify%20more%20on%20this%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FLI%3E%3CLI%3E%3CDIV%20class%3D%22public-DraftStyleDefault-block%20public-DraftStyleDefault-ltr%22%3E%3CSPAN%3ETable%203%2C%20instead%20of%20doing%20it%20manually%20and%20count%2C%20would%20be%20useful%20if%20there's%20any%20formulae%2FVBA%20to%20simplify%20this.%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FLI%3E%3C%2FOL%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22malcolmaaron22_0-1630657982362.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F307907iDF911010D5A828A9%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22malcolmaaron22_0-1630657982362.png%22%20alt%3D%22malcolmaaron22_0-1630657982362.png%22%20%2F%3E%3C%2FSPAN%3E%3CUL%3E%3CLI%3E%3CSTRONG%3EDevice%20and%20OS%20platform%3C%2FSTRONG%3E%3A%20PC%2FWindows%2010%20Enterprise%20Version%201909%3C%2FLI%3E%3CLI%3E%3CSTRONG%3EExcel%20product%20name%20and%20version%20number%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3BMicrosoft%20365%20Apps%20for%20enterprise%3B%20Version%202102%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2716157%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2716400%22%20slang%3D%22en-US%22%3ERe%3A%20Count%20the%20adjacent%20cells%20date%20for%20people%20database%20on%20their%20check-in%20check-out%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2716400%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1145666%22%20target%3D%22_blank%22%3E%40malcolmaaron22%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFormula%20for%20the%20Count%20Pax%20column%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DCOUNTIFS(Table2%5BCheck%20In%20Date%5D%2C%22%26lt%3B%3D%22%26amp%3B%5B%40Date%5D%2CTable2%5BCheck%20out%20Date%5D%2C%22%26gt%3B%3D%22%26amp%3B%5B%40Date%5D)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20don't%20understand%20how%20you%20arrived%20at%20the%20numbers%20in%20your%20sample%20results.%20On%2020-Aug%2C%20for%20example%2C%20Person%20A%20had%20already%20checked%20out%2C%20so%20only%20B%20and%20C%20remained%2C%20and%20D%20checked%26nbsp%3B%20in%2C%20hence%20I%20count%203%2C%20but%20you%20have%204...%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20would%20even%20argue%20that%20you%20should%20use%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3DCOUNTIFS(Table2%5BCheck%20In%20Date%5D%2C%22%26lt%3B%3D%22%26amp%3B%5B%40Date%5D%2CTable2%5BCheck%20out%20Date%5D%2C%22%26gt%3B%22%26amp%3B%5B%40Date%5D)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eif%20you%20don't%20want%20to%20count%20someone%20on%20the%20day%20they%20check%20out.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor
I would like to know if there's a way to count if a range of dates is within the given date. In this example, the occupied rooms in a fixed single location based on their check-in and check-out dates, Person A check in on 15/08 and check out on 19/08, I would like the formula to count 1 on summary table on 15/08, 16/08, 17/08 and so on.

There's a lot of examples to check if a date is between a range of dates but can't find the other way around so far.

Here's the example on my questions along with the example file attached:
  1. Table 1 is the database of people, real case scenario I have around 3000+ names to work with
  2. Table 2 is the summary count of each date I want it to be. Example below should clarify more on this
  3. Table 3, instead of doing it manually and count, would be useful if there's any formulae/VBA to simplify this.
malcolmaaron22_0-1630657982362.png
  • Device and OS platform: PC/Windows 10 Enterprise Version 1909
  • Excel product name and version number Microsoft 365 Apps for enterprise; Version 2102
1 Reply

@malcolmaaron22 

Formula for the Count Pax column:

 

=COUNTIFS(Table2[Check In Date],"<="&[@Date],Table2[Check out Date],">="&[@Date])

 

I don't understand how you arrived at the numbers in your sample results. On 20-Aug, for example, Person A had already checked out, so only B and C remained, and D checked  in, hence I count 3, but you have 4...

 

I would even argue that you should use

 

=COUNTIFS(Table2[Check In Date],"<="&[@Date],Table2[Check out Date],">"&[@Date])

 

if you don't want to count someone on the day they check out.