Macro to define a interval

February 7, 2011 at 00:29:03
Specs: Windows 7
Hello,

i have a excel sheet of details of employee of the organisation.

in that sheet i have a column D of age. i have to define age interval for that.

the age interval is given as 18-25,25-30 is mention is the sheet2 cells A2=18, A3=25, A4=40,

Please give me the code for inserting a column E and define the interval in that in which the age of the employee falls.

Thanks in advance!


See More: Macro to define a interval

Report •


#1
February 8, 2011 at 17:42:13
re: "the age interval is given as 18-25,25-30 is mention is the sheet2 cells A2=18, A3=25, A4=40,"

2 things don't make sense:

1 - The first "interval" ends at 25, and the second one starts at 25.

In which interval would a 25 year old belong?

2 - "is mention is the sheet2 cells A2=18, A3=25, A4=40,"

I have no clue what this means.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
February 8, 2011 at 20:22:08
Sorry!

It should like,
the age interval is given as 18-25,26-30 is mention is the sheet2 cells A2=18, A3=25, A4=30 and so on.

I have to do this exercise regularly, i have different type group at each time.

My concern is generate a macro which take the interval value from a sheet (e.g. in cell A1, A2 ............................ A25) and data from the same sheet (in column B:B) . and define the data in those interval values to the next column of the data (in column C:C).

Regards!
Rahul


Report •

#3
February 9, 2011 at 04:53:08
I'm still not sure what you mean by "define the data in those interval values to the next column of the data"

Please read the How To referenced in my signature line and post an example table showing both the input data and the expected output.

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

Related Solutions

#4
February 10, 2011 at 02:58:35
I have a workbook in which sheet1 has data like this(few rows from the large data) :

  A               B               C             D         E               F              G          
Membership  No	Store Location	Member Date	AGE	Age Group	Date of Birth	Marital Status
: 1001010168001	Norway	         17-Aug-09        25	21-30 	         13-Feb-86	Married
: 1001010168002	LA	         30-Jul-09        15	Below  20 	 22-Oct-95	Single
: 1001010168003	Norway	         17-Aug-09        31	31-40 	         30-Oct-79	Married
: 1001010168004	LA	         30-Jul-09        60	Above 50 	 03-Aug-82	Single
: 1001010168005	LA	         30-Jul-09        46		         06-Jan-65	Single
: 1001010168006	LA	         30-Jul-09        47		         24-Nov-63	Married
: 1001010168007	Norway	         17-Aug-09        25		         17-Mar-85	Married
: 1001010168010	LA	         17-Aug-09        60		         13-Jun-50	Single
: 1001010168011	Norway	         17-Aug-09        34		         25-Aug-76	Single
: 1001010168012	Norway	         17-Aug-09        29		         29-Jan-82	Married
: 1001010168013	Norway	         17-Aug-09        33		         02-Jun-77	Married
: 1001010168014	Norway	         17-Aug-09        33		         26-Dec-77	Married
: 1001010168015	LA	         28-Jul-09        22		         29-Oct-88	Single
: 1001010168016	LA	         17-Aug-09        24		         04-Feb-87	Single

and in sheet2 i have the interval. like this

A
Intervals
0
21
31
41
51

the interval may be is more than five for other time its can go up to 15.

In this data i have to define age in these groups (column E). like the first four rows i have done manually.

hope you will understand the problem, so please send the macro for this.

Thanks!



Report •


Ask Question