How to find the 5th occurrence and return the date and location information?

schappelljr

Board Regular
Joined
Feb 2, 2009
Messages
55
I’ve been stuck on this problem for a while now. I have a large spreadsheet that I am trying to find when and where the 5th occurrence happens. I would like to use a helper column to display the values if not a list of the location and time would work. Below is an example.



[TABLE="width: 634"]
<tbody>[TR]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]unique ID[/TD]
[TD]Date[/TD]
[TD]Location[/TD]
[TD]5th location[/TD]
[TD]5th Date[/TD]
[/TR]
[TR]
[TD]Steve2580[/TD]
[TD]1/2/19[/TD]
[TD]Store 1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Steve2580[/TD]
[TD]1/5/19[/TD]
[TD]Store 3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Amanda1665[/TD]
[TD]1/9/19[/TD]
[TD]Store 2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Nikki5566[/TD]
[TD]1/15/19[/TD]
[TD]Store 6[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Steve2580[/TD]
[TD]1/18/19[/TD]
[TD]Store 7[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Courtney4444[/TD]
[TD]1/20/19[/TD]
[TD]Store 2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Steve2580[/TD]
[TD]1/22/19[/TD]
[TD]Store 4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Kevin5532[/TD]
[TD]1/23/19[/TD]
[TD]Store 3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Steve2580[/TD]
[TD]1/26/19[/TD]
[TD]Store 7[/TD]
[TD]Store 7[/TD]
[TD]1/26/19[/TD]
[/TR]
[TR]
[TD]Frank6677[/TD]
[TD]1/27/19[/TD]
[TD]Store 2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Steve2580[/TD]
[TD]2/1/19[/TD]
[TD]Store 1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Steve2580[/TD]
[TD]2/15/19[/TD]
[TD]Store 1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Xavier[/TD]
[TD]2/17/19[/TD]
[TD]Store 20[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Like this?

ABCDEF
unique IDDateLocation5th location5th Date
Steve2580Store 1
Steve2580Store 3
Amanda1665Store 2
Nikki5566Store 6
Steve2580Store 7
Courtney44441/20/2019Store 2
Steve2580Store 4
Kevin5532Store 3
Steve2580Store 7Store 7
Frank6677Store 2
Steve2580Store 1
Steve2580Store 1
XavierStore 20

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]1/2/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]1/5/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]1/9/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]1/15/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]1/18/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]1/22/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]1/23/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]10[/TD]

[TD="align: right"]1/26/2019[/TD]

[TD="align: right"]1/26/2019[/TD]
[TD="align: right"][/TD]

[TD="align: center"]11d>[/TD]

[TD="align: right"]1/27/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]12[/TD]

[TD="align: right"]2/1/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]13[/TD]

[TD="align: right"]2/15/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]14[/TD]

[TD="align: right"]2/17/2019[/TD]

[TD="align: right"][/TD]

</tbody>
Sheet6

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]D2[/TH]
[TD="align: left"]=IF(COUNTIF($A$2:$A2,$A2)=5,C2,"")[/TD]
[/TR]
[TR]
[TH]E2[/TH]
[TD="align: left"]=IF(COUNTIF($A$2:$A2,$A2)=5,B2,"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
A quick way would be to simply click on Unique ID and then go to the Data tab and select Filter.

You can then select the ID you want and count down five. That's quick but not what you want.

HTH Don
 
Upvote 0
When I looked at this post Eric W had not posted yet, by the time I hit post quick reply he had, and he had a better way.

dang slow internet....
 
Upvote 0
If you're interested in a list, without helper columns, maybe Advanced Filter + a formula as criteria.

Something like this

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
A
[/TD]
[TD="bgcolor: #DCE6F1"]
B
[/TD]
[TD="bgcolor: #DCE6F1"]
C
[/TD]
[TD="bgcolor: #DCE6F1"]
D
[/TD]
[TD="bgcolor: #DCE6F1"]
E
[/TD]
[TD="bgcolor: #DCE6F1"]
F
[/TD]
[TD="bgcolor: #DCE6F1"]
G
[/TD]
[TD="bgcolor: #DCE6F1"]
H
[/TD]
[TD="bgcolor: #DCE6F1"]
I
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD]
unique ID​
[/TD]
[TD]
Date​
[/TD]
[TD]
Location​
[/TD]
[TD][/TD]
[TD]
unique ID​
[/TD]
[TD]
Date​
[/TD]
[TD]
Location​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD]
Steve2580​
[/TD]
[TD]
1/2/2019​
[/TD]
[TD]
Store 1​
[/TD]
[TD][/TD]
[TD]
Steve2580​
[/TD]
[TD]
1/26/2019​
[/TD]
[TD]
Store 7​
[/TD]
[TD][/TD]
[TD]
FALSE​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD]
Steve2580​
[/TD]
[TD]
1/5/2019​
[/TD]
[TD]
Store 3​
[/TD]
[TD][/TD]
[TD]
Nikki5566​
[/TD]
[TD]
2/22/2019​
[/TD]
[TD]
Store6​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
4
[/TD]
[TD]
Amanda1665​
[/TD]
[TD]
1/9/2019​
[/TD]
[TD]
Store 2​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
5
[/TD]
[TD]
Nikki5566​
[/TD]
[TD]
1/15/2019​
[/TD]
[TD]
Store 6​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
6
[/TD]
[TD]
Steve2580​
[/TD]
[TD]
1/18/2019​
[/TD]
[TD]
Store 7​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
7
[/TD]
[TD]
Courtney4444​
[/TD]
[TD]
1/20/2019​
[/TD]
[TD]
Store 2​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
8
[/TD]
[TD]
Steve2580​
[/TD]
[TD]
1/22/2019​
[/TD]
[TD]
Store 4​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
9
[/TD]
[TD]
Kevin5532​
[/TD]
[TD]
1/23/2019​
[/TD]
[TD]
Store 3​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
10
[/TD]
[TD]
Steve2580​
[/TD]
[TD]
1/26/2019​
[/TD]
[TD]
Store 7​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
11
[/TD]
[TD]
Frank6677​
[/TD]
[TD]
1/27/2019​
[/TD]
[TD]
Store 2​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
12
[/TD]
[TD]
Steve2580​
[/TD]
[TD]
2/1/2019​
[/TD]
[TD]
Store 1​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
13
[/TD]
[TD]
Steve2580​
[/TD]
[TD]
2/15/2019​
[/TD]
[TD]
Store 1​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
14
[/TD]
[TD]
Xavier​
[/TD]
[TD]
2/17/2019​
[/TD]
[TD]
Store 20​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
15
[/TD]
[TD]
Nikki5566​
[/TD]
[TD]
2/18/2019​
[/TD]
[TD]
Store 3​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
16
[/TD]
[TD]
Xavier​
[/TD]
[TD]
2/19/2019​
[/TD]
[TD]
Store 7​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
17
[/TD]
[TD]
Nikki5566​
[/TD]
[TD]
2/20/2019​
[/TD]
[TD]
Store 2​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
18
[/TD]
[TD]
Nikki5566​
[/TD]
[TD]
2/21/2019​
[/TD]
[TD]
Store 1​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
19
[/TD]
[TD]
Nikki5566​
[/TD]
[TD]
2/22/2019​
[/TD]
[TD]
Store6​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
20
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Leave I1 empty
Formula in I2
=COUNTIF(A$2:A2,A2)=5

Select your data range including headers (A1:C19)

Data > Advanced Filter
check Copy to another location
List Range: $A$1:$C$19
Criteria Range: $I$1:$I$2
Copy to: $E$1

M.
 
Upvote 0
Like this?

ABCDEF
unique IDDateLocation5th location5th Date
Steve2580Store 1
Steve2580Store 3
Amanda1665Store 2
Nikki5566Store 6
Steve2580Store 7
Courtney44441/20/2019Store 2
Steve2580Store 4
Kevin5532Store 3
Steve2580Store 7Store 7
Frank6677Store 2
Steve2580Store 1
Steve2580Store 1
XavierStore 20

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]1/2/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]1/5/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]1/9/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]1/15/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]1/18/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]

[TD="align: center"]8[/TD]

[TD="align: right"]1/22/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]1/23/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]10[/TD]

[TD="align: right"]1/26/2019[/TD]

[TD="align: right"]1/26/2019[/TD]
[TD="align: right"][/TD]

[TD="align: center"]11d>[/TD]

[TD="align: right"]1/27/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]12[/TD]

[TD="align: right"]2/1/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]13[/TD]

[TD="align: right"]2/15/2019[/TD]

[TD="align: right"][/TD]

[TD="align: center"]14[/TD]

[TD="align: right"]2/17/2019[/TD]

[TD="align: right"][/TD]

</tbody>
Sheet6

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]D2[/TH]
[TD="align: left"]=IF(COUNTIF($A$2:$A2,$A2)=5,C2,"")[/TD]
[/TR]
[TR]
[TH]E2[/TH]
[TD="align: left"]=IF(COUNTIF($A$2:$A2,$A2)=5,B2,"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Thank you!
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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