+ Reply to Thread
Results 1 to 4 of 4

VBA to Check date of birth and age and put remarks

  1. #1
    Forum Contributor
    Join Date
    02-13-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    140

    VBA to Check date of birth and age and put remarks

    I have data with Name, Date of birth and Age as per format. I need vba code to check the age of the persons.

    Need common Remarks in Column O


    if Self (As per Relation mentioned "in Column I) age is less than 18 years (As per age mentioned "in Column K) then need result as "Self age is less than 18 years "in Column O.

    if Spouce (As per Relation mentioned "in Column I) age is less than 18 years (As per age mentioned "in Column K) then need result as "Spouce age is less than 18 years "in Column O.

    if Father (As per Relation mentioned "in Column I) age is less than 18 years (As per age mentioned "in Column K) then need result as "Father age is less than 18 years "in Column O.

    if Mother (As per Relation mentioned "in Column I) age is less than 18 years (As per age mentioned "in Column K) then need result as "Mother age is less than 18 years "in Column O.

    if Father-in-law (As per Relation mentioned "in Column I) age is less than 18 years (As per age mentioned "in Column K) then need result as "Father-in-law age is less than 18 years "in Column O.

    if Mother-in-Law (As per Relation mentioned "in Column I) age is less than 18 years (As per age mentioned "in Column K) then need result as "Mother-in-Law age is less than 18 years "in Column O.

    if Self (As per Relation mentioned "in Column I) age is above 80 years (As per age mentioned "in Column K) then need result as "Self age is above 80 years "in Column O.

    if Spouce (As per Relation mentioned "in Column I) age is above 80 years (As per age mentioned "in Column K) then need result as "Spouce age is above 80 years "in Column O.

    if Father (As per Relation mentioned "in Column I) age is above 80 years (As per age mentioned "in Column K) then need result as "Father age is above 80 years "in Column O.

    if Mother (As per Relation mentioned "in Column I) age is above 80 years (As per age mentioned "in Column K) then need result as "Mother age is above 80 years "in Column O.

    if Father-in-law (As per Relation mentioned "in Column I) age is above 80 years (As per age mentioned "in Column K) then need result as "Father-in-law age is above 80 years "in Column O.

    if Mother-in-Law (As per Relation mentioned "in Column I) age is above 80 years (As per age mentioned "in Column K) then need result as "Mother-in-Law age is above 80 years "in Column O.

    if any Child (Child, Child2, Child3,…. age is above 25 years (As per age mentioned "in Column K) then need result as "Child age is above 25 years "in Column O. For other child "Child2 age is above 25 years OR Child3 age is above 25 years"

    Also Need Some Logical Remarks in Column O


    If age difference between Self and Spouce is less than 15 years then need result as "Self and Spouce age difference is less than 15 years "in Column O.

    If age difference between Self and Child, Child2, Child3….. is less than 15 years then need result as "Self and Child age difference is less than 15 years "in Column O.

    If age difference between Self and Father is less than 15 years then need result as "Self and Father age difference is less than 15 years "in Column O.

    If age difference between Self and Mother is less than 15 years then need result as "Self and Mother age difference is less than 15 years "in Column O.

    If age difference between Self and Father-in-law is less than 15 years then need result as "Self and Father-in-law age difference is less than 15 years "in Column O.

    If age difference between Self and Mother-in-law is less than 15 years then need result as "Self and Mother-in-law age difference is less than 15 years "in Column O.

    If age difference between Spouce and Child, Child2, Child3….. is less than 15 years then need result as "Spouce and Child age difference is less than 15 years "in Column O.

    If age difference between Spouce and Father is less than 15 years then need result as "Spouce and Father age difference is less than 15 years "in Column O.

    If age difference between Spouce and Mother is less than 15 years then need result as "Spouce and Mother age difference is less than 15 years "in Column O.

    If age difference between Spouce and Father-in-law is less than 15 years then need result as "Spouce and Father-in-law age difference is less than 15 years "in Column O.

    If age difference between Spouce and Mother-in-law is less than 15 years then need result as "Spouce and Mother-in-law age difference is less than 15 years "in Column O.

    If any cell in Age (Column I) contains following


    #NUM! Wrong Age Mentioned
    #N/A Wrong Age Mentioned
    #NULL! Wrong Age Mentioned
    #REF! Wrong Age Mentioned
    #DIV/0! Wrong Age Mentioned
    ##### Wrong Age Mentioned
    Errors Wrong Age Mentioned
    OR any kind of error Wrong Age Mentioned


    This is very Important for me. Please help me with code.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA to Check date of birth and age and put remarks

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    02-13-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    140

    Re: VBA to Check date of birth and age and put remarks

    Hi John,

    It works exactly i wanted. Thank you very for the same. Great help!!!

    Just one more clarification

    In family no. 10024 (i.e. between row no. 16 to 20) in row Number 18 as per baove code one remark is reflecting. Actually there are two remarks "Child age is above 25 years / Spouce and Child age difference is less than 15 years"

    there are more than 1 remarks hence remarks are separated by "/". Can you please change the code accordingly

  4. #4
    Forum Contributor
    Join Date
    02-13-2014
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    140

    Re: VBA to Check date of birth and age and put remarks

    Also John,

    After running the code the remarks are reflecting in remarks Column and after changing the age in column K when running the code again it shows same remarks.

    For example.
    In Cell K7 the remarks was "Spouce age is less than 18 years". But when I changed the age to 19 years the remark is still same.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA to master check in two column if criteria met give remarks in F
    By johnlara in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2016, 02:25 PM
  2. Replies: 2
    Last Post: 11-03-2014, 10:29 AM
  3. Work out Term of Birth by Date of Birth
    By sezza79 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-18-2014, 11:06 AM
  4. Formulas Calculating Age based on Date of Birth & Date of Death
    By MELLOW YELLOW in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-07-2014, 03:27 PM
  5. [SOLVED] In Remarks Column the Remarks should be as described as the attached excel file
    By robin.das077 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-30-2013, 03:38 AM
  6. Date Difference and remarks
    By mubashar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2013, 11:41 AM
  7. Converting Date of Birth to 'Term of Birth'
    By Kungfusal in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-26-2009, 04:12 AM

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