PC Review


Reply
Thread Tools Rate Thread

Asking for better logic to avoid multiple if's.

 
 
Spy128Bit@gmail.com
Guest
Posts: n/a
 
      17th Jan 2007
I have been trying to find a better method to loop through the data
than a series of if statements. What I am trying to do is go down a
list of employees and determine which preference they were able to fit
into and subtract that from a set value..

If we started with 1 in each time frame from 6:00AM to 2:00PM in two
hour increments the following data would end up as listed below.

Name Full/Part Rank 1 2 3 4 5
Student A Full 1 8:00 AM 10:00 AM 6:00 AM 12:00 PM 2:00 PM
Student B Full 2 6:00 AM 8:00 AM 10:00 AM 12:00 PM 2:00 PM
Student C Full 4 6:00 AM 8:00 AM 10:00 AM 12:00 PM 2:00 PM
Student D Full 5 6:00 AM 8:00 AM 10:00 AM 12:00 PM 2:00 PM
Student E Full 6 12:00 PM 10:00 AM 8:00 AM 6:00 AM 2:00 PM

Assigned
Student A 8:00 AM - First preference and a slot available so it's
filled.
Student B 6:00 AM - First preference and a slot available so it's
filled.
Student C 10:00 AM - First two preference are already completed
filled so 3rd is used.
Student D 12:00 PM - First three preferences are already filled so
4th is used.
Student E 2:00 PM - First four preferences are already filled so
5th is used.

On the full list there are a varying number of slots available in each
time slot. What I was beginning to do so far was loop across checking
each slot for availability then moving on to the next one if there was
none or subtracting one and going to the next employee. I could
continue this way but it would end up being close to 25-30 if
statements and I'm just asking if there is better logic to use here
than that. Any ideas would be appreciated.

Excel 2003 is the version being used.

Thanks!

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      17th Jan 2007

A macro something like looking down each name with an offset as to their 1st
choice, offset 2 for 2nd,etc>check count of list of preference>if empty
copy/move name to bottom of that list and exit the for .>if not look in the
next list> etc

--
Don Guillett
SalesAid Software
(E-Mail Removed)
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have been trying to find a better method to loop through the data
> than a series of if statements. What I am trying to do is go down a
> list of employees and determine which preference they were able to fit
> into and subtract that from a set value..
>
> If we started with 1 in each time frame from 6:00AM to 2:00PM in two
> hour increments the following data would end up as listed below.
>
> Name Full/Part Rank 1 2 3 4 5
> Student A Full 1 8:00 AM 10:00 AM 6:00 AM 12:00 PM 2:00 PM
> Student B Full 2 6:00 AM 8:00 AM 10:00 AM 12:00 PM 2:00 PM
> Student C Full 4 6:00 AM 8:00 AM 10:00 AM 12:00 PM 2:00 PM
> Student D Full 5 6:00 AM 8:00 AM 10:00 AM 12:00 PM 2:00 PM
> Student E Full 6 12:00 PM 10:00 AM 8:00 AM 6:00 AM 2:00 PM
>
> Assigned
> Student A 8:00 AM - First preference and a slot available so it's
> filled.
> Student B 6:00 AM - First preference and a slot available so it's
> filled.
> Student C 10:00 AM - First two preference are already completed
> filled so 3rd is used.
> Student D 12:00 PM - First three preferences are already filled so
> 4th is used.
> Student E 2:00 PM - First four preferences are already filled so
> 5th is used.
>
> On the full list there are a varying number of slots available in each
> time slot. What I was beginning to do so far was loop across checking
> each slot for availability then moving on to the next one if there was
> none or subtracting one and going to the next employee. I could
> continue this way but it would end up being close to 25-30 if
> statements and I'm just asking if there is better logic to use here
> than that. Any ideas would be appreciated.
>
> Excel 2003 is the version being used.
>
> Thanks!
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo box with multiple values but no logic mmcsassin Microsoft Powerpoint 1 30th Jul 2007 04:38 PM
Countif Using Multiple Logic Tests =?Utf-8?B?Q2FybA==?= Microsoft Excel Worksheet Functions 3 4th Jun 2006 07:09 AM
Most efficient way of applying multiple conditional logic booksnore Microsoft C# .NET 2 22nd Nov 2005 11:47 PM
Sending from Multiple Account in Outlook (avoid multiple polls to server) Phil Jones Microsoft Outlook 3 15th Jun 2005 06:53 AM
Nested Logic Statements with multiple logic Jerry Microsoft Excel Worksheet Functions 9 17th Aug 2003 08:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:12 AM.