• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 60
  • Last Modified:

Selecting 3 records before and 3 after

Hi Experts

We have a data that contains a route id, drop sequence, truck id and if it participates in our program (yes or no).  What we would like is to get a new tab that would show us the truck, the participants (those marked "YES") and the 3 stops (using drop sequence) before the record and 3 after (ones marked "no")  so we would end up with 7 records total for each routeid (including the one marked "yes".

Any help would be greatly appreciated.
0
spudmcc
Asked:
spudmcc
  • 4
  • 3
1 Solution
 
Katie PierceCommented:
Can you upload a sample of the data layout you have?
0
 
spudmccAuthor Commented:
It would have to be sorted by Truck then by Route then by Drop #
EXAMPLE.xlsx
0
 
Katie PierceCommented:
Have you tried a Pivot Table yet?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
spudmccAuthor Commented:
Yes, the problem is that it will give me the universe but won't give the just the 3 records below and the 3 records above itself.
0
 
Katie PierceCommented:
OK, I got so far as associating the 3 before and the three after with all the YESes.  At this point you'd probably need a VBA to condense the data on a new tab and unfortunately I'm not at all versed in VBAs.

Personally, I'd copy and paste values, then sort all the YESes together (you have to copy and paste values, otherwise the Before/After formulas will pull the wrong data).
0
 
Katie PierceCommented:
Oops, here's the file
EXAMPLE-1.xlsx
0
 
spudmccAuthor Commented:
Thank you so much for your time and knowledge.  This will save us lots of time.  

Andy
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now