+ Reply to Thread
Results 1 to 13 of 13

Putting length of service into age brackets

  1. #1
    Registered User
    Join Date
    05-31-2017
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Putting length of service into age brackets

    Hi All,

    I have previously posted this on another forum, received some support but nothing for the last two weeks. I have seen that it can be frowned upon to ask the same question across forums so please let me know if this is against etiquette.

    My original question asked

    'I am trying to work out how to calculate length of service into different age brackets. I have attached a simple excel example to hopefully help explain.

    What I need is a calculation that breaks the length of service into the following age brackets

    18-21 years
    22-40 years
    41+ years

    This should be capped at a maximum of 20 years working down from the age on leaving.

    For example for someone who on leaving is 45 years old and has 25 years service their breakdown would be

    18-21 years 0
    22-40 years 16
    41+ years 4

    I have been trying to come up with some sort of calculation but this is above my ability and haven't got close. It is also quite tricky to explain like this so feel free to tell me if this makes no sense.'


    I received the attached 'first attempt' workbook which works beautifully at segregating the length of service into age brackets, however it does not cap the age at 20 years. The attached 'cap need' document shows what I would like it to calculate in the blue box.

    I wonder if anyone is able to suggest some alterations to the formulas that will cap at 20 years working down from higher to lower ages?

    Hopefully this makes sense but please let me know if you require any further info.

    Many thanks

    Tom
    Attached Files Attached Files

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Putting length of service into age brackets

    I think you need to add MIN-function.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    I put these formulas in P2:P4 of the sheet (attached)
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Registered User
    Join Date
    05-31-2017
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Putting length of service into age brackets

    Hi Tsjallie,

    Thanks for the quick response.

    When i had the original response on the other forum i altered their formula to fit my workbook as mine does not use a table. I should have made this clear but had hoped i could do the same with any responses on here, apologies for that.

    Below is an updated formula that fits my

    HTML Code: 
    Looking at yours i am unable to make it fit into the above however i am a noob to these sorts of formulas.

    Is there a way i can adjust my formula above to work or will i need to introduce a table to my workbook?

    Many thanks for your help

    Tom

  4. #4
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Putting length of service into age brackets

    i altered their formula to fit my workbook as mine does not use a table
    Is it a completely different structure or just not a table?
    ...or will i need to introduce a table to my workbook?
    You don't need to, but I always highly recommend the use of tables instead of ranges.

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

    Re: Putting length of service into age brackets

    But if you must...

    select the table, TABLE TOOLS/DESIGN/TOOLS/CONVERT TO RANGE

    and the formulae change automatically. I'm not a huge fan of tables, personally...
    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

  6. #6
    Registered User
    Join Date
    05-31-2017
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Putting length of service into age brackets

    It is a similar structure, the main difference is some cells it references are on another sheet. Other changes are the age brackets run across columns rather the down a column.

    I am quite new to the excel world and am at the stage where i can alter formulas and VBA code to help fit my needs for the most part but i have not looked into tables yet. I will do some reading and try out a few to see how they work.

    Thanks for your help with this

    Tom

  7. #7
    Registered User
    Join Date
    05-31-2017
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Putting length of service into age brackets

    Quote Originally Posted by Glenn Kennedy View Post
    But if you must...

    select the table, TABLE TOOLS/DESIGN/TOOLS/CONVERT TO RANGE

    and the formulae change automatically. I'm not a huge fan of tables, personally...
    Thanks Glenn,

    Great bit of info that will no doubt help me out.

  8. #8
    Registered User
    Join Date
    05-31-2017
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Putting length of service into age brackets

    Hi Tsjallie,

    I have implemented your formulas and tried a few variants however the calculations don't work for all.

    I have attached the original sheet with your formulas added. When you use the drop down box Joe Bloggs works fine however the other two are displayed oddly. I have inserted 2 red boxes which show what i would like to have as a result of the formulas.

    Many thanks for your support.

    Tom

  9. #9
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Putting length of service into age brackets

    Hmm, think it's something with an ill reference. Will have a look at it.

  10. #10
    Registered User
    Join Date
    05-31-2017
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Putting length of service into age brackets

    Thanks Tsjallie

  11. #11
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Putting length of service into age brackets

    Ok, I think I got it now.
    All three formulas now check if the age is valid for a bracket (PB and GR shouldn't have years in the 41+ bracket) and
    they all also consider the LengthOfService now. So the result for a bracket will be the smallest of Bracket-years, (remaining) Service Years and the (remaining) limit of 20 years.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    As you can see the formulas are now pretty lengthy and hard to read.
    I think it would be good practice to define and use some names to make it more readable.
    For example the 18-22 years formula could also look like this
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    05-31-2017
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Putting length of service into age brackets

    Thanks Tsjallie

    I have implemented the above and tested it, the formulas work beautifully.

    Thank you so much for your help, it is appreciated.

    Tom

  13. #13
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Putting length of service into age brackets

    Hi Tom,
    good to hear that and thx for the rep!
    If your problem is fully fixed pls mark the thread SOLVED (see Thread Tools above).

+ 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. Length of Service in Years and Months?
    By JannieYorkie in forum Excel General
    Replies: 1
    Last Post: 03-20-2012, 05:51 AM
  2. Excel 2007 : Length of service in age bands
    By SteveLaird in forum Excel General
    Replies: 0
    Last Post: 09-21-2011, 10:17 AM
  3. Can VB compare string length in and out of brackets?
    By cncf in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-07-2009, 10:18 AM
  4. Deleting brackets and numbers of varied length.
    By Yappa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-21-2008, 08:41 AM
  5. calculating length of service within age bands
    By Margot in forum Excel General
    Replies: 3
    Last Post: 01-26-2007, 08:37 AM
  6. Length of Service
    By Dom in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-17-2006, 05:55 PM
  7. [SOLVED] Length of Service
    By Dom in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-17-2006, 03:26 PM
  8. Determine Length of Service
    By TheLeafs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-03-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