[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

creating groups using VBA

Posted on 2011-02-19
8
Medium Priority
?
304 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
[X]
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
8 Comments
 

Author Comment

by:maudette
ID: 34934325
anyone?
0
 
LVL 8

Accepted Solution

by:
Toxacon earned 1000 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"
        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 1000 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

=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
ID: 35215549
Please Close
0
 

Author Comment

by:maudette
ID: 35215567
Close
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

649 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