creating groups using VBA

Posted on 2011-02-19
Last Modified: 2012-08-14
I have provided the fields that I am using and what I need returned.  I need to organize 12 students into two project teams using their birthday (year is not important) I need to use If/Then  statements for project 1 to categorize the people into two groups born Jan1-June 30th marking them as "Group 1" and then categorize the people born July 1-Dec 30 as "Group 2".  they need to be called in column called in the project 1 column.  For project 2 I need to use select case statement.  "Group A" for this project should include people born January 1-March 31, "Group B" should include people born April 1-June 30.... etc.  

Last Name	First Name	Birthday	UID     	Project 1 team      Project 2 team
Doe      	John     	9/25/1973	U16253817		
Doe     	Jane     	8/2/1982	U55990265		
Doe     	Juile     	7/26/1986	U28098838		
Doe     	Joe     	12/22/1973	U55098179		
Doe     	Jessica     	11/25/1970	U42647584		
Doe     	Jole     	12/20/1979	U79697656		
Doe     	Jumper     	1/13/1971	U73549073		
Doe     	Justin     	5/7/1984	U69504570		
Doe     	Joel     	6/1/1975	U44076419		
Doe     	Jule     	5/2/1983	U61142789		
Doe     	Jeep     	5/7/1978	U11856501		
Doe     	Jolie     	4/3/1987	U17426253

Open in new window

Question by:maudette
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3

Author Comment

ID: 34934325

Accepted Solution

Toxacon earned 250 total points
ID: 34936237
Try this:

Option Explicit

Sub ArrangeGroups()
    Dim iLoop As Integer, Month As Integer
    For iLoop = 2 To 13
        Month = DatePart("M", Worksheets("Sheet1").Cells(iLoop, 3).Value)
        If Month < 7 Then
            Worksheets("Sheet1").Cells(iLoop, 5).Value = "X"
            Worksheets("Sheet1").Cells(iLoop, 6).Value = "X"
        End If
End Sub

Open in new window

LVL 30

Assisted Solution

SiddharthRout earned 250 total points
ID: 34936976
No need for VBA. Here is a sample attached.

If your data is from say cell A1 to F13 then this formula will go

in E2


and this

in F2




Author Comment

ID: 35215549
Please Close

Author Comment

ID: 35215567

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This collection of functions covers all the normal rounding methods of just about any numeric value.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question