• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Codes for Assiging

Loki

New Member
I need VBA code to assign seat numbers for passengers. Our group size ranges from 30 to 44 passengers, and we usually use a bus with a 2x2 seating layout. The trip typically lasts 5 to 8 days. Every day, I need to rearrange the passenger seating so they can enjoy the trip fairly and without any discrimination. Most of the passengers are couples, and we need to seat them next to each other.

We have a column called GRN in our data, which helps us identify the couples.

Initially, we have raw data that is not sorted by age. On the first day, we need to seat passengers according to seniority based on age. From the next day onwards, the seating arrangement should be done fairly for everyone.


I have uploaded a sample file for your reference.
 

Attachments

What has changed?
 
Sir everyday the seat should be on otation basis so that every one can get a chance to seated in front / middle / back . i need to atleast 5 to 8 days rotation series
 
Do You have a sample expected results?
This could be a challenge: every one can get a chance to seated in front / middle / back
 
I hope every one will get a chance to sit atleast in a first two rows i their journey or else it should be a fair rule that everone should be satisified
 
FRI
i have tired a formula =OFFSET($B$2, MOD((ROW()-2) + (COLUMN()-1)*4, 44), 0) for day 02 seating arrangement like this i have done but it doesn't worked well. I am looking something better i have attached a sample file pls check and i need some improvisiation on that
 

Attachments

Thank you, sir. That was pretty good, but I need some more help. I cannot mention the names of the passengers because the seat numbers are jumbled. Is there any VBA code that can match the seat numbers and automatically assign the corresponding passenger names?
 
... hmm?
You wrote that You cannot mention the names of the passengers
but later You wrote that You would like to do so ... so what?
Where are the seat numbers?

I could make my variation, but ...
Do You have any idea - how would You use this?
= what would You need to show/give to someone?
 
I gotta guess those Your the seat numbers ...
You looked for something, but You'll get something more clear to read.
with [ PDF ] is possible to get ... PDFs to PDF-folder
 

Attachments

... with this is possible to show those seats more clear
Usage:
# select any name
# press [ Seat ]
## back to normal by selecting NAME-cell
### with [ Seat ] > [ PDF ] can get Seat PDFs
 

Attachments

Sir thank you for the reply but i am looking something like - i have tried to explain in the file uploaded have a look at once by means of colour to arrange seating every day
 

Attachments

Is there any reason, why You skipped to give this layout at once?
Why it's different than Your previous versio?

Below gives basically same information per couple.
Screenshot 2025-09-28 at 20.24.28.png
 
Back
Top