Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Formula to auto generate age group based on age

  • 29-10-2020 11:21PM
    #1
    Registered Users, Registered Users 2 Posts: 8


    Not great at Excel as I am only learning but I have a list of patients, their DOB and their age which generated by formula based on DOB.

    I want to create a formula that will select a pre-determined age group based on the age.
    The age groups are as follows 0 - 4, 5 - 17, 18 - 64, 65+


    Be grateful for any help.
    Tagged:


Comments

  • Registered Users, Registered Users 2 Posts: 25,944 ✭✭✭✭coylemj


    Substitute the cell address or field name containing the age for 'age' below......

    =if(age<5,"0-4",if(age<18,"5-17",if(age<65,"18-64","65+")))


  • Registered Users, Registered Users 2 Posts: 8 carenmc


    Thanks, only issue is that it doesn't account for cells with no DOB in it and returns a value of 65+ meaning my figures will be out.


  • Registered Users, Registered Users 2, Paid Member Posts: 1,711 ✭✭✭JoyPad


    carenmc wrote: »
    Thanks, only issue is that it doesn't account for cells with no DOB in it and returns a value of 65+ meaning my figures will be out.

    You can add a check for non-null value:

    =if(isblank(age),"Unknown", if(...))

    The if(...) is meant to be the existing condition from coylemj.

    I subscribed to keep boards.ie alive!
    boards.ie: Now Ye're Subscribing



Advertisement