+ Reply to Thread
Results 1 to 11 of 11

Formula for recognising dates between and outside a range of start and end times?

  1. #1
    Registered User
    Join Date
    01-15-2021
    Location
    London
    MS-Off Ver
    Version 16.44 2020
    Posts
    20

    Formula for recognising dates between and outside a range of start and end times?

    Thanks for help with this problem:

    I am building a staff salary forecast for the next 5 years, annually.

    I have a Start Date, an End Date, and then the Year End dates for each of the 5 years I am forecasting. I also have the Annual Salary.

    I need a formula that helps me a) calculate Part salary in a year where an employee joins during the year. I have figured that out using the DATEDIF formula. So I can calculate the amount of time for the year a person works.

    What I am not able to figure out, is what formula do I add to say "if the person is working during this financial year THEN insert their salary for the year". Meaning, what if a person leaves (End Date) half way through a year OR a person works full time for the 5 year period?

    Also in my table, I do not have End Dates for employees at present because no one has left yet but I want to build it that if/when someone leaves, I can calculate their Part Salary for that year in which they leave. So the only inputs I have are a Start Date and then my 5 financial years and their salary amount?

    Can anyone please help me figure out these situations (to account for someone leaving in next 5 years so only working a part year) AND to recognise a normal full years salary in the full years between the start and end year?
    Attached Files Attached Files
    Last edited by CarinaC21; 01-17-2021 at 05:16 PM. Reason: see attached my Excel Spreadsheet

  2. #2
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Formula for recognising dates between and outside a range of start and end times?

    Please attach a sample file as per the instructions in the yellow banner it makes life much easier and you will get a quicker answer. include what you expect as the answer , even if it is by hand. cover all your scenarios

  3. #3
    Registered User
    Join Date
    01-15-2021
    Location
    London
    MS-Off Ver
    Version 16.44 2020
    Posts
    20

    Re: Formula for recognising dates between and outside a range of start and end times?

    Just attached the file i am building. Thanks.

  4. #4
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Formula for recognising dates between and outside a range of start and end times?

    You can have a logic of it startdate <= last day of year year which is the same as < first day of next year (so they have worked in the year), and Enddate > start of financial year or blank then do the calculation

    enddate, end of financial year

    datedif(min of (end date , end of year),max(startdate, star of year),"D")/365

    but is this how your staff are paid? most staff are paid monthly so the payment is parts of the partial months and a 12th of the salary for ach full month, can you advise?


    https://www.mrexcel.com/board/thread...l-137.1153601/
    Last edited by davsth; 01-18-2021 at 05:13 AM.

  5. #5
    Registered User
    Join Date
    01-15-2021
    Location
    London
    MS-Off Ver
    Version 16.44 2020
    Posts
    20

    Re: Formula for recognising dates between and outside a range of start and end times?

    Thank you for those suggestions. I need to do this two ways. Firstly, the high level Annual Salary estimates which I think your formula above will do for me. Then I need to do a 12 month forecast, so monthly salary, so then I will need to adjust this formula, it will still read off start date and end date but need to calculate the monthly salary due, or whether a salary is payable for a given month?

  6. #6
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Formula for recognising dates between and outside a range of start and end times?

    so what is the outline of your sheet to do the second point? Why not attach?

  7. #7
    Registered User
    Join Date
    01-15-2021
    Location
    London
    MS-Off Ver
    Version 16.44 2020
    Posts
    20

    Re: Formula for recognising dates between and outside a range of start and end times?

    Hi there, thanks so much for your assitance with this. So I am working on the Monthly Salary Forecasts and I do not know how to work the formula to work when I do not know a staff END DATE eg it is Blank for now.

    See attached the formula I am using for Start Date and End Date estimates of which months there will be a salary: =IF((AND(G$6>=$D9, G$6<=$E9)),$F9/12,0). where G6 = Current month, D9 - Start Date, E9 = End Date. But this doesnt work when there is BLANK in the End Date?
    Attached Files Attached Files
    Last edited by CarinaC21; 01-19-2021 at 03:36 PM. Reason: See attached workings

  8. #8
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Formula for recognising dates between and outside a range of start and end times?

    It is easy enough to say that if I started on the 10th of January, I was here for 22 days in the month and so should get 22/31 of the monthly salary, are you happy with this. If I worked a 6 month contract, the monthly figures may not add up to 6 calendar month

    eg 10 feb to 9 aug
    feb 19/28 of month
    mar-July full month
    august 9/31st of month

    do you care?!


    the below may work
    =MAX((MIN($E9,EOMONTH(G$6,0))-MAX($D9,G$6))+1,0)/DAY(EOMONTH(G$6,0))*$F9/12

  9. #9
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,583

    Re: Formula for recognising dates between and outside a range of start and end times?

    Try this . If E9 is blank It will take Today's date.

    =IF((AND(G$6>=$D9, G$6<=IF($E9="",TODAY(),E$9))),$F9/12,0)
    Last edited by kvsrinivasamurthy; 01-20-2021 at 07:23 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  10. #10
    Registered User
    Join Date
    01-15-2021
    Location
    London
    MS-Off Ver
    Version 16.44 2020
    Posts
    20

    Re: Formula for recognising dates between and outside a range of start and end times?

    Thank you so much. That formula works perfectly and allows for pro rata days during a month only partly worked. Thanks!

  11. #11
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,583

    Re: Formula for recognising dates between and outside a range of start and end times?

    Thanks for feed Back .Pl mark the thread solved.

+ 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. Formula to see if start and end times fits a range of times
    By YMUNSHI in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-26-2019, 06:44 PM
  2. Finding Start/End Dates and Times
    By sa1ntj0hn in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-28-2018, 07:12 AM
  3. Need a formula with flexible start and end dates from a range
    By Lax97 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2017, 12:23 PM
  4. Replies: 21
    Last Post: 05-11-2015, 03:53 PM
  5. [SOLVED] Creating a formula to populate range of cells between dates based on start and end dates
    By Rainmain82 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-20-2014, 07:42 PM
  6. [SOLVED] Creating a formula to populate range of cells between dates based on start and end dates
    By Rainmain82 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-18-2014, 07:55 AM
  7. Recognising dates for formula output
    By BravoBravo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-11-2008, 01:21 AM

Tags for this Thread

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