Subset data set by removing records with only one row per hour

Buck1480

Board Regular
Joined
Feb 1, 2009
Messages
102
I have a data set of GPS locations for a wildlife research project. GPS locations were collected 2x per hour (every 30 mins). However, the GPS collars sometimes would miss a location resulting in 1 location/hour. I need to subset my data set to only include locations where I have 2 GPS locations per hour (i.e., remove rows with only one location per hour). My issue is that due to the hierarchical data structure (GPS locations are nested within individual animal ID, Month, Day, Year, and Hour) I cannot find a simple solution to remove rows with only 1 location/hour. In the example data set below, I would only keep the locations at 10 am and 10:30 am (noted in red). In other words, I need to obtain a final file that contains only data with 2 locations per hour. Thanks for any help that you can provide!

[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Collar_ID[/TD]
[TD]DATETIME[/TD]
[TD]WEEK[/TD]
[TD]YEAR[/TD]
[TD]MONTH[/TD]
[TD]DAY[/TD]
[TD]HOUR[/TD]
[TD]MOVEMENT_DISTANCE[/TD]
[TD]NET_DISPLACEMENT[/TD]
[/TR]
[TR]
[TD]33827[/TD]
[TD]10/1/2013 8:00[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]10[/TD]
[TD]3.6[/TD]
[/TR]
[TR]
[TD]33827[/TD]
[TD]10/1/2013 10:00[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]78.1[/TD]
[TD]135.4[/TD]
[/TR]
[TR]
[TD]33827[/TD]
[TD]10/1/2013
10:30
[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]99.8[/TD]
[TD]205.7[/TD]
[/TR]
[TR]
[TD]33827[/TD]
[TD]10/1/2013 11:00[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]1[/TD]
[TD]11[/TD]
[TD]92.7[/TD]
[TD]222.7[/TD]
[/TR]
[TR]
[TD]33827[/TD]
[TD]10/1/2013 13:00[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]1[/TD]
[TD]13[/TD]
[TD]27.7[/TD]
[TD]370.5[/TD]
[/TR]
[TR]
[TD]33827[/TD]
[TD]10/1/2013 14:30[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]1[/TD]
[TD]14[/TD]
[TD]8[/TD]
[TD]372.0[/TD]
[/TR]
[TR]
[TD]33827[/TD]
[TD]10/1/2013 15:00[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]10[/TD]
[TD]1[/TD]
[TD]15[/TD]
[TD]5[/TD]
[TD]366.0[/TD]
[/TR]
</tbody>[/TABLE]





 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Why wouldn't the last two (which are within 1/2 hour of each other) be retained? Is it because the first one does not start "on the hour"?
 
Upvote 0
Why wouldn't the last two (which are within 1/2 hour of each other) be retained? Is it because the first one does not start "on the hour"?

That's correct! First location needs to be at the start of the hour (e.g., 14:00 followed by the second location at 14:30).
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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