+ Reply to Thread
Results 1 to 4 of 4

Data Shuffling (with a Condition) in Scattered Cells (Selection)

  1. #1
    Registered User
    Join Date
    09-23-2012
    Location
    Turkey
    MS-Off Ver
    Excel 2010
    Posts
    6

    Data Shuffling (with a Condition) in Scattered Cells (Selection)

    Hi all,

    Let's say I have a list of non-unique personnel names in A1:A60 (Sheet2) and scattered and selected cells like A2, B3, C1, E5 etc. (Sheet1.)

    How do I distribute (shuffle, randomize etc.) these personnel names (sheet2) in selection (sheet1) with this condition:

    If the personnel name is non-unique then after shuffling, the number of rows between same personnel names must be 2 or more. For example, after shuffling, A2 and B3 in sheet1 shouldnt contain the same name. A2 and E5 could contain the same name because there are sufficient number of rows between A2 and E5.

    How can I do that with VBA and if possible, how can I add additional conditions to shuffling?

    Thanks in advance.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Data Shuffling (with a Condition) in Scattered Cells (Selection)

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    09-23-2012
    Location
    Turkey
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Data Shuffling (with a Condition) in Scattered Cells (Selection)

    Quote Originally Posted by xladept View Post
    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Thanks for interest.

    Here is a sample workbook to visualize for what i was trying to explain. I've changed some things.

    Instead of non-unique names, I've used "Shift Count" to show you how many hours a personnel will work for a day.

    If a personnel will work at 00:00 - 02:00 shift then his/her next shift should be 4 hours laters at least (06:00 - 08:00 or later). If personnel count isn't enough, this condition can be 2 hours except between 00:00 - 06:00 (night shift).
    Attached Files Attached Files

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Data Shuffling (with a Condition) in Scattered Cells (Selection)

    Hi quanom,

    I see that you have 27 personnel while three rows account for 21 of those personnel (when there is no break) - so, are there some rules that we need to know to program this "shuffling"?
    Last edited by xladept; 01-18-2014 at 03:56 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Shuffling cells
    By MrBurns in forum Excel General
    Replies: 9
    Last Post: 08-21-2012, 12:32 AM
  2. Replies: 1
    Last Post: 05-26-2012, 05:37 PM
  3. Data shuffling challenge
    By vnascimento in forum Excel General
    Replies: 4
    Last Post: 05-14-2012, 04:50 PM
  4. Delete rows in scattered selection
    By ESF in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2012, 06:22 AM
  5. Shuffling data
    By CellGL5371 in forum Excel General
    Replies: 1
    Last Post: 03-04-2007, 04:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1