+ Reply to Thread
Results 1 to 2 of 2

Return a text string based on age

  1. #1
    Registered User
    Join Date
    01-27-2016
    Location
    Bedford, IN
    MS-Off Ver
    Office 2010
    Posts
    1

    Return a text string based on age

    I want to get a text string based on a child's age, such as "3 y, 6 m, 2 d" which I've already managed to generate in cell B6 using =DATEDIF(A6,"8/1/"& B4,"y")&" years, "&DATEDIF(A6,"8/1/"& B4,"ym")&" months, "&DATEDIF(A6,"8/1/"& B4,"md")&" days".

    If the child's age is 0 years, 0 months, 1 days to 2 years, 5 months, 31 days, I want it to return "EHS" in cell D6.

    If the child's age is 2 years, 6 months, 0 days to 2 years, 11 months, 31 days, I want it to return "Gap" in cell D6.

    If the child's age is 3 years, 0 months, 0 days to 4 years, 11 months, 31 days, I want it to return "HS" in cell D6.

    And if the child's age is 5 years, 0 months, 0 days or older I want it to return "Age Inelligible" in cell D6.

    I'm thinking database, but I am self-taught and lost at the moment. Any help would be greatly appreciated.
    Last edited by JamieWildman; 01-27-2016 at 04:06 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Return a text string based on age

    Hi, welcome to the forum

    I think the best way to do this it NOT convert to text - do the datedif part, then just compare that to however many days are in your range
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. Replies: 2
    Last Post: 05-14-2015, 01:30 PM
  2. Replies: 4
    Last Post: 03-30-2015, 03:20 PM
  3. [SOLVED] Search for a text string and return given text string to adjacent cell
    By hecgroups in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-14-2015, 04:50 AM
  4. [SOLVED] IF range of cells contains string of text, return contents of cell where string is found
    By nobodyukno in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-03-2013, 09:56 AM
  5. [SOLVED] Find partial text string within another text string return original text into cell.
    By mikey42979 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-17-2013, 02:58 PM
  6. Replies: 1
    Last Post: 04-08-2013, 07:07 PM
  7. Return Value Based On Partial Text String
    By JonnyBoy333 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-12-2011, 09:29 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