+ Reply to Thread
Results 1 to 6 of 6

Age bracket not working!

  1. #1
    Forum Contributor
    Join Date
    10-04-2007
    Posts
    118

    Age bracket not working!

    I have created a query to work the age bracket from the Date of Birth to date of visit, both fields are date and time

    below are some example of this.

    Note that the age bracket of 0-16 isn't a correct result. what is wrong with the query?


    Date_Of_Birth DateofVisit Age Bracket
    06-Oct-1907 09-May-2008 0 - 16
    06-Oct-1907 12-May-2008 0 - 16
    06-Oct-1907 13-May-2008 0 - 16
    06-Oct-1907 06-May-2008 0 - 16
    06-Oct-1907 03-May-2008 0 - 16
    06-Oct-1907 20-May-2008 0 - 16
    06-Oct-1907 16-May-2008 0 - 16
    06-Oct-1907 19-May-2008 0 - 16
    06-Oct-1907 08-May-2008 0 - 16
    06-Oct-1907 07-May-2008 0 - 16
    06-Oct-1907 14-May-2008 0 - 16
    06-Oct-1907 15-May-2008 0 - 16
    06-Oct-1907 06-May-2008 0 - 16
    06-Oct-1907 13-May-2008 0 - 16


    Age Bracket:
    IIf(([DateofVisit]-([Date_Of_Birth]))/365<='16','0 - 16',
    IIf(([DateofVisit]-([Date_Of_Birth]))/365 Between '17' And '30','17 - 30',
    IIf(([DateofVisit]-([Date_Of_Birth]))/365 Between '31' And '65','31 - 65',
    IIf(([DateofVisit]-([Date_Of_Birth]))/365 Between '66' And '75','66 - 74','75+'))))
    Last edited by akhlaq768; 01-08-2009 at 07:08 AM.

  2. #2
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421
    Umm...question. I noticed on all your dates of birth...the year is 1907 - making everyone 100+ years old.

    Can you upload a copy of worksheet. It might help with identifying the specific issue.

  3. #3
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421
    Here is a formula for C1 (with A1 being Date of Birth, and B1 being your visit date)

    Please Login or Register  to view this content.
    This will check to see if there is a date of birth, if not...output is a blank...same if there is not a visit date.

    Hope this helps...otherwise, upload a copy of the file. I'll be on tommorrow to see if you still don't have it resolved.

  4. #4
    Forum Contributor
    Join Date
    10-04-2007
    Posts
    118
    cheers will give it a go

  5. #5
    Forum Contributor
    Join Date
    10-04-2007
    Posts
    118
    as requested i have attached the database containing the raw table and the query im using to work out the age bracket correctly, as im getting errors for any people in the 100, they all turn to "0-16"
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    10-04-2007
    Posts
    118
    got it sorted,



    thanks mate

+ 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