+ Reply to Thread
Results 1 to 7 of 7

Fill category field if date macro/formula

  1. #1
    Registered User
    Join Date
    04-16-2010
    Location
    Aveiro
    MS-Off Ver
    Excel 2010
    Posts
    4

    Exclamation Fill category field if date macro/formula

    Hello!
    I'm new to this forum and i hope i can get my problem fix here.
    So here is what I'm trying to do.
    I have a athletic worksheet were i have basic information about the participants of an racing event and i need to fill a row corresponding to the category the participant should run based on his birth date.
    Example:
    If he was born in1999 or 2000 he should run in the benjamin, so his category field should be filled with benj.
    If it's possible doing it through a macro or formula would save me a lot of time since i have event's of 500+ participants and doing this manually takes many time.
    I have some basic knowledge of excel so if even you can just throw me some lights on how to do it for one category i can manage to make to the other i need.
    Thanks in advanced and hope to have a possible solution soon.
    Cheers !!!
    Attached Files Attached Files
    Last edited by propheta; 04-16-2010 at 11:53 AM. Reason: question solved

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Fill category field if date macro/formula

    What are the other catagories?
    ie if born before 1999 or after 2000

    This might possibly be solved with a simple If formula

    On the lines of

    =IF(YEAR(F2)<1999,"old Cat",IF(YEAR(F2)>2000,"young cat","benj"))

    in cell "I2" and fill down

    Hope this helps.

    If you need any further information, please feel free to ask further

    However

    If this takes care of your needs, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED. It helps everybody!
    Also
    If you are satisfied by any members response to your problem please consider using the scales icon top right of thier post to show your appreciation.

  3. #3
    Registered User
    Join Date
    04-16-2010
    Location
    Aveiro
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Fill category field if date macro/formula

    Maybe i explain myself badly :S
    I ment that people born in between the years 1999 and 2000 must run on the same category (benj) problem is that there are many more categories so it takes some effort to make it one by one.
    I'll give the rest of the categories and the dates that fill them
    BENJ - 1999/2000
    INF - 1998/1997
    INI - 1996/1995
    JUN - 1994/1993
    JUV - 1992/1991
    SEN - 1990/1971
    VET1 - 1970/1966
    VET2 - 1965/1961
    VET3 - 1960/1956
    VET4 - 1955/1951
    VET5 - 1950 onwards

    as you can see it's a lot of them and the idea was to save me time making this an automatic process if possible.
    Cheers !!!

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Fill category field if date macro/formula

    This is one way.

    1/. Add a sheet called "AgeCategory" and list all the years from 1950 to 2000 with the relevant grouping.
    This will easily allow you to change the grouping names or year grouping.
    This sheet can be hidden if you want.

    2/. In "I2"

    =IF(YEAR(F2)>2000,"???",IF(YEAR(F2)<1950,"VET5",VLOOKUP(YEAR(F2),AgeCategory!$A$2:$B$52,2,FALSE)))

    Fill down

    N.B.
    I don't know what to do with year of birth > 2000, so I put in "???" change this to what you need.

    An updated workbook attached.

    Hope this helps.

    If you need any further information, please feel free to ask further

    However

    If this takes care of your needs, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED. It helps everybody!
    Also
    If you are satisfied by any members response to your problem please consider using the scales icon top right of thier post to show your appreciation.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-16-2010
    Location
    Aveiro
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Fill category field if date macro/formula

    Thanks a lot for that suggestion!
    It works very good for what i intended, but ... if i could add just one more thing to the formula would be great.
    Make the formula also attend to the field gender so it would make a M/F sub category.
    Example:
    IF it was born in 1999/2000 and it's M/F (benj-m or benj-f)
    Hope it was explicit! Also i don't want to make anyone my employee and i really appreciate all the help anyone can give.
    If what i requested isn't possible please post it here so i can make this thread as solved as the current solution is very good.
    Cheers !!!

  6. #6
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Fill category field if date macro/formula

    Your wish is my command!

    Amended workbook attached

    Cheers
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-16-2010
    Location
    Aveiro
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Fill category field if date macro/formula

    Absolutely wonderful !!!
    Exactly what i needed ... really appreciate the help given here as it will help me save time in the future.
    Cheers !!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1