+ Reply to Thread
Results 1 to 14 of 14

Help with =IF/And OR vs calculating DOB less than 18 years of Age

  1. #1
    Forum Contributor
    Join Date
    09-27-2017
    Location
    USA
    MS-Off Ver
    MS365 - 2302
    Posts
    163

    Help with =IF/And OR vs calculating DOB less than 18 years of Age

    HI,

    =IF(AL2="",AND(OR(S2="IN",S2="KY",S2="HI",S2="WV")*TODAY()-N2/365))

    Above is the formula I wrote to calculate less than 18 years for particular states.

    This is what I a trying to achieve and not sure how to go about it.

    Column AL has ID
    Column S has States
    Column N has DOB
    Column AE has Enroll Date

    Now if Column AL = Blank and Column S has the states listed above i:e IN, KY, HI, TN, WV and the DOB (Age of the student is below 18) from the Date of Enroll in Column AE is should highlight as TRUE

    Can this be done?

    Thank you in Advance

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,984

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    Will you please attach a SMALL sample Excel workbook (10-20 rows of data is usually enough)? However, please give us an indication of the approximate number of rows of data you want the solution to work with (100, 1000, 100,000 or whatever). Please don't attach a picture of an Excel sheet (no-one will want to re-type all your stuff before starting).

    1. It does NOT have to be your real sheet - mock up a SAMPLE if you need to. But not 1000's of rows!!! It makes manual checking so tedious. Whatever you do... make sure that all confidential information is removed first!!

    2. Make sure that your sample data are truly REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    3. Make sure that your desired solution is also shown (mock up the results manually).

    4. Try to avoid using merged cells. They cause lots of problems!

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    where is AE in your formula? You have AL but not AE.
    AND, what difference does it make if the ID (in AL) is blank but one of those states is in col S?
    What you want can be done, so as Glenn recommended, a sample workbook with expected results will go a long way.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Forum Contributor
    Join Date
    09-27-2017
    Location
    USA
    MS-Off Ver
    MS365 - 2302
    Posts
    163

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    I have attached a Mini Temp because the file was too big.


    Now Column C has the State D has the DOB E has DOJ F has ID and G is where the formula should be at.

    ID is for students who have already enrolled or we have given a unique ID for if its blank its mostly a new or a re enrollment.

  5. #5
    Forum Contributor
    Join Date
    09-27-2017
    Location
    USA
    MS-Off Ver
    MS365 - 2302
    Posts
    163

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    nr6281
    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    I have attached a Mini Temp because the file was too big.


    Now Column C has the State D has the DOB E has DOJ F has ID and G is where the formula should be at.

    ID is for students who have already enrolled or we have given a unique ID for if its blank its mostly a new or a re enrollment.

  6. #6
    Forum Contributor
    Join Date
    09-27-2017
    Location
    USA
    MS-Off Ver
    MS365 - 2302
    Posts
    163

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    ++ attachment added and the details below
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    09-27-2017
    Location
    USA
    MS-Off Ver
    MS365 - 2302
    Posts
    163

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    Hi Attached the template

    DOB Should show if its less than 18 years at the time of joining

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    I'm confused about what your results should be. Is it that you want TRUE or FALSE depending on their age with TRUE for greater than 18 and FALSE for less than 18?
    And those TRUE/FALSE would be based on their ages at the date of joining? Because based on a quick check, nobody is younger than 20 years old.

    plus, your formula you had... =IF(F2="",AND(OR(C2="IN",C2="KY",C2="HI",C2="WV")*TODAY()-D2/365-E2)) the multiplication is not multiplying anything.
    just correcting that it should be =IF(F2="",AND(OR(C2="IN",C2="KY",C2="HI",C2="WV"),TODAY()-D2/365-E2)) which will yield different results.

  9. #9
    Forum Contributor
    Join Date
    09-27-2017
    Location
    USA
    MS-Off Ver
    MS365 - 2302
    Posts
    163

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    Yes it has to be true for someone who is below 18 or 18 at the date of joining. And False for someone who is over 18 years at the date of joining.

  10. #10
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    you have two people with joining dates in 2035 and as best as I can tell nobody is less than 18 years of age.
    we asked that you provide expected results so we can see but you just provided the workbook with your formula.
    Now I'd ask that you also provide the hierarchy of the decision tree so if the states are KY and IN etc AND the ID is blank AND (or is it OR) the date of joining minus the DOB is 18 or less OR today minus the DOB is 18 or less, what happens and what happens when the states aren't those and the ID is present and today - the DOB is 18 or less OR the states aren't in your list but the ID isn't present and they are less than 18?

  11. #11
    Forum Contributor
    Join Date
    09-27-2017
    Location
    USA
    MS-Off Ver
    MS365 - 2302
    Posts
    163

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    I am sorry I havent explained this in detail.

    Now the data I added is only a sample one.

    Here is in detail what I am trying to achieve not sure if this is possible.

    IF the ID is blank, the states Match and DOB is less than 18 years at the date of joining it should return as TRUE = It should return TRUE only if all these match
    IF ID is blank but the states dont match but the student is still less than 18 at the date of joining than its should come as FALSE.

    SO basically the states has to Match and ID blank.

  12. #12
    Forum Contributor
    Join Date
    09-27-2017
    Location
    USA
    MS-Off Ver
    MS365 - 2302
    Posts
    163

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    HI I have attached a file without the formula and what I am trying to get I am sorry this is a bit of a complicated thing for me to explain too
    Attached Files Attached Files
    Last edited by nr6281; 08-02-2019 at 04:48 PM.

  13. #13
    Forum Contributor
    Join Date
    09-27-2017
    Location
    USA
    MS-Off Ver
    MS365 - 2302
    Posts
    163

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    @Sambo Kid, DO you require more information on it?

  14. #14
    Forum Contributor
    Join Date
    06-30-2015
    Location
    Netherlands
    MS-Off Ver
    2013 / 2016 / 365
    Posts
    145

    Re: Help with =IF/And OR vs calculating DOB less than 18 years of Age

    Hi,

    Based on the temp template you've added, try this:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    HtH,

    Joris

    --------------------------------------------------------------------------------
    If you found my answer helpful, please hit the Like or Thank button.

    Please follow the forum Rules and Guidelines and use Code tags around your VBA code.

    Remember: test VBA code always on a copy of your file because usually you can't use undo

+ 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. Calculating how many years £x will last
    By Ian99099 in forum Excel General
    Replies: 2
    Last Post: 03-25-2019, 12:27 PM
  2. [SOLVED] Calculating Years of Service in YEARS and MONTHS
    By joliver in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 10-07-2013, 10:22 AM
  3. calculating the age in years and months
    By diltselizabeth in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-22-2009, 04:36 AM
  4. Calculating % Rate over years
    By Fabbyfil in forum Excel General
    Replies: 4
    Last Post: 07-30-2009, 04:11 PM
  5. calculating days between years
    By greg99 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-08-2007, 09:18 PM
  6. Replies: 15
    Last Post: 12-09-2006, 05:27 PM
  7. calculating the years
    By DKY in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-20-2006, 03:10 PM

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