Repeat guest stay count

Shahuru

New Member
Joined
Dec 4, 2018
Messages
11
Office Version
  1. 2016
Platform
  1. Windows
I wanted to a list of repeat guest count for consecutive stay dates. the back to back stays are considered as one stay. John stay from A - C should be as 1 stay and stay F should show as a new result as 2 since the stay date is not after the last checkout date. For D and E result should show as 1 as it is one stay with multiple dates.

stayNameCheck inCheck outResult/ stay
AJohn
11/12/2019​
13/12/2019​
1​
BJohn
13/12/2019​
14/12/2019​
CJohn
14/12/2019​
15/12/2019​
DJames
28/10/2019​
30/10/2019​
1​
EJames
30/10/2019​
01/11/2019​
FJohn
01/01/2020​
03/01/2021​
2​
GMartin
30/10/2019​
01/11/2019​
1​
HKim
30/10/2019​
01/11/2019​
1​

Thanks,
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Is this what you mean?

21 09 19.xlsm
ABCDE
1stayNameCheck inCheck outResult/ stay
2AJohn12/11/201913/12/20191
3BJohn13/12/201914/12/2019 
4CJohn14/12/201915/12/2019 
5DJames28/10/201930/10/20191
6EJames30/10/201911/01/2019 
7FJohn1/01/20201/03/20212
8GMartin30/10/201911/01/20191
9HKim30/10/201911/01/20191
Stays
Cell Formulas
RangeFormula
E2:E9E2=IF(AND(B2=B1,C2=D1),"",COUNTIFS(B$1:B1,B2,E$1:E1,">0")+1)
 
Upvote 0
Thanks Peter, can you help me to change the value to Zero for consecutive stays, ei; A, B, C to 0. as in below table James has two stay ( D & E - consecutive stay) to 1 as James has another stay in H , in short All consecutive dates to zero but if has another stay date then the value to 2 based on the stay counts.

RowNameCheck inCheck outResult / stay
AJohn
11/12/2019​
13/12/2019​
0​
BJohn
13/12/2019​
14/12/2019​
0​
CJohn
14/12/2019​
15/12/2019​
0​
DJames
28/10/2019​
30/10/2019​
2​
EJames
30/10/2019​
01/11/2019​
FKim
01/01/2020​
03/01/2021​
1​
GMartin
30/10/2019​
01/11/2019​
1​
HJames
30/11/2019​
01/12/2019​
2​

Thanks,
 
Upvote 0
Thanks Peter, can you help me to change the value to Zero for consecutive stays, ei; A, B, C to 0.
Why above should be 0

as in below table James has two stay ( D & E - consecutive stay) to 1
Why above is 1

as James has another stay in H , in short All consecutive dates to zero but if has another stay date then the value to 2 based on the stay counts.

This is what Peter's formula doing

Book1
ABCDE
1RowNameCheck inCheck outResult / stay
2AJohn11/12/201913/12/20191
3BJohn13/12/201914/12/20190
4CJohn14/12/201915/12/20190
5DJames28/10/201930/10/20191
6EJames30/10/201901/11/20190
7FKim01/01/202003/01/20211
8GMartin30/10/201901/11/20191
9HJames30/11/201901/12/20192
Sheet3
Cell Formulas
RangeFormula
E2:E9E2=IF(AND(B2=B1,C2=D1),0,COUNTIFS(B$1:B1,B2,E$1:E1,">0")+1)
 
Upvote 0
I want to all conservative stays to be zero and if same guest has multiple stays then the result to 1
 
Upvote 0
Book1
ABCDE
1stayNameCheck inCheck outResult/ stay
2AJohn12-Nov-1913-Dec-191
3BJohn13-Dec-1914-Dec-19 
4CJohn14-Dec-1915-Dec-19 
5DJames28-Oct-1930-Oct-191
6EJames30-Oct-1911-Jan-19 
7FJohn01-Jan-2001-Mar-212
8GMartin30-Oct-1911-Jan-191
9HKim30-Oct-1911-Jan-191
Sheet1
Cell Formulas
RangeFormula
E2:E9E2=IF(COUNTIF($B$2:B2,B2)=1,1,IF(LOOKUP(10^35,$D$1:D1/($B$1:B1=B2))=C2,"",LOOKUP(10^35,$E$1:E1/($B$1:B1=B2))+1))
 
Upvote 0
hanks Peter, can you help me to change the value to Zero for consecutive stays, ei; A, B, C to 0. as in below table James has two stay ( D & E - consecutive stay) to 1 as James has another stay in H , in short All consecutive dates to zero but if has another stay date then the value to 2 based on the stay counts.
I'm not sure why Row E in your sample is blank in the final column but otherwise this replicates your results.

21 09 20.xlsm
ABCDE
1RowNameCheck inCheck outResult / stay
2AJohn12/11/201913/12/20190
3BJohn13/12/201914/12/20190
4CJohn14/12/201915/12/20190
5DJames28/10/201930/10/20192
6EJames30/10/201911/01/20192
7FKim1/01/20201/03/20211
8GMartin30/10/201911/01/20191
9HJames30/11/201912/01/20192
Stays
Cell Formulas
RangeFormula
E2:E9E2=IF(AND(OR(AND(B2=B1,C2=D1),AND(B2=B3,D2=C3)),SUMPRODUCT(--(B$2:B$9=B2),--(B$1:B$8&D$1:D$8<>B$2:B$9&C$2:C$9))=1),0,SUMPRODUCT(--(B$2:B$9=B2),--(B$1:B$8&D$1:D$8<>B$2:B$9&C$2:C$9)))
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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