Solved

creating groups using VBA

Posted on 2011-02-19
8
254 Views
Last Modified: 2012-08-14
Hello,
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

           
   
0
Comment
Question by:maudette
  • 3
8 Comments
 

Author Comment

by:maudette
Comment Utility
anyone?
0
 
LVL 8

Accepted Solution

by:
Toxacon earned 250 total points
Comment Utility
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"
        Else
            Worksheets("Sheet1").Cells(iLoop, 6).Value = "X"
        End If
    Next
End Sub

Open in new window

0
 
LVL 30

Assisted Solution

by:SiddharthRout
SiddharthRout earned 250 total points
Comment Utility
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

=IF(VALUE(TEXT(C2,"m"))<7,"Group1","Group2")

and this

in F2

=IF(VALUE(TEXT(C2,"m"))<4,"GroupA",IF(VALUE(TEXT(C2,"m"))<7,"GroupB",IF(VALUE(TEXT(C2,"m"))<10,"GroupC","GroupD")))

Sid

Grouping.xls
0
 

Author Comment

by:maudette
Comment Utility
Please Close
0
 

Author Comment

by:maudette
Comment Utility
Close
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now